try to make sure compiler/include/mmakefile is always refreshed correctly.
[AROS.git] / rom / intuition / changedecorationa.c
blob715631828616b3af2962696686f2cf559eb2956a
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/utility.h>
8 #include <intuition/windecorclass.h>
9 #include <intuition/scrdecorclass.h>
10 #include <intuition/screens.h>
12 #include <proto/dos.h>
14 #include "intuition_intern.h"
15 #include "intuition_customize.h"
16 #include "inputhandler_actions.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/intuition.h>
23 AROS_LH2(void, ChangeDecoration,
25 /* SYNOPSIS */
26 AROS_LHA(ULONG, ID, D0),
27 AROS_LHA(struct NewDecorator *, nd, A0),
29 /* LOCATION */
30 struct IntuitionBase *, IntuitionBase, 152, Intuition)
32 /* FUNCTION
33 Setup a new decorator for intuition windows, screens or menus.
35 INPUTS
36 ID - identifier for decorations, see screens.h
37 nd - an ID dependent NewDecorator structure
39 RESULT
40 None.
42 NOTES
43 The function fails if screens are open; use ChangeIntuition() to
44 notify applications that the UI will be changed.
46 This function is private and AROS-specific. Do not use it in regular
47 applications.
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 intuition/screens.h
56 INTERNALS
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
62 ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
63 if (ID == DECORATION_SET)
66 /* if the current decorator isn´t used remove it */
68 struct NewDecorator * tnd;
69 tnd = ((struct IntIntuitionBase *)(IntuitionBase))->Decorator;
70 if ((tnd != NULL) && (tnd != nd))
72 int_UnloadDecorator(tnd, IntuitionBase);
76 nd->nd_cnt = 0;
78 BOOL global = TRUE;
80 if (nd->nd_Pattern != NULL)
82 nd->nd_IntPattern = AllocVec(strlen(nd->nd_Pattern) * 2 + 1, MEMF_CLEAR);
83 if (nd->nd_IntPattern)
85 struct DosLibrary *DOSBase = GetPrivIBase(IntuitionBase)->DOSBase;
86 if (!DOSBase)
87 GetPrivIBase(IntuitionBase)->DOSBase = DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 36);
89 if (DOSBase)
91 if (ParsePattern(nd->nd_Pattern, nd->nd_IntPattern, strlen(nd->nd_Pattern) * 2 + 1) == -1)
93 FreeVec(nd->nd_IntPattern);
94 nd->nd_IntPattern = NULL;
96 else
97 global = FALSE;
102 nd->nd_ScreenObjOffset = ((IPTR) ( (char *)&((struct IntScreen *)0)->ScrDecorObj - (char *)0 ));
103 nd->nd_ScreenMenuObjOffset = ((IPTR) ( (char *)&((struct IntScreen *)0)->MenuDecorObj - (char *)0 ));
104 nd->nd_ScreenWindowObjOffset = ((IPTR) ( (char *)&((struct IntScreen *)0)->WinDecorObj - (char *)0 ));
106 D(bug("intuition.decor: offsets titleobj = %d, menuobj = %d, winobj = %d\n", nd->nd_ScreenObjOffset, nd->nd_ScreenMenuObjOffset, nd->nd_ScreenWindowObjOffset);)
107 Enqueue(&((struct IntIntuitionBase *)(IntuitionBase))->Decorations, (struct Node *)nd);
109 if (global)
111 ((struct IntIntuitionBase *)(IntuitionBase))->Decorator = nd;
112 ((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorClass = nd->nd_ScreenClass;
113 ((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorTags = nd->nd_ScreenTags;
114 ((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorClass = nd->nd_MenuClass;
115 ((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorTags = nd->nd_MenuTags;
116 ((struct IntIntuitionBase *)(IntuitionBase))->WinDecorClass = nd->nd_WindowClass;
117 ((struct IntIntuitionBase *)(IntuitionBase))->WinDecorTags = nd->nd_WindowTags;
120 ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
122 AROS_LIBFUNC_EXIT