fix properties
[AROS.git] / rom / intuition / hidewindow.c
blobba312f81e8a1b15f67771a158bf74e37173350e9
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/layers.h>
8 #include "showhide.h"
9 #include "intuition_intern.h"
10 #include "inputhandler_actions.h"
12 #ifdef CGXSHOWHIDESUPPORT
13 #undef ChangeLayerVisibility
14 struct HideWindowActionMsg
16 struct IntuiActionMsg msg;
17 struct Window *window;
20 static VOID int_hidewindow(struct HideWindowActionMsg *msg,
21 struct IntuitionBase *IntuitionBase);
22 #endif
24 #ifdef ChangeLayerVisibility
25 struct HideWindowActionMsg
27 struct IntuiActionMsg msg;
28 struct Window *window;
31 static VOID int_hidewindow(struct HideWindowActionMsg *msg,
32 struct IntuitionBase *IntuitionBase);
33 #endif
35 /*****************************************************************************
37 NAME */
38 #include <proto/intuition.h>
40 AROS_LH1(VOID, HideWindow,
42 /* SYNOPSIS */
43 AROS_LHA(struct Window *, window, A0),
45 /* LOCATION */
46 struct IntuitionBase *, IntuitionBase, 141, Intuition)
48 /* FUNCTION
49 Make a window invisible.
51 INPUTS
52 window - The window to affect.
54 RESULT
55 None.
57 NOTES
58 This function is compatible with AmigaOS v4.
60 EXAMPLE
62 BUGS
64 SEE ALSO
65 ShowWindow()
67 INTERNALS
69 HISTORY
71 *****************************************************************************/
73 AROS_LIBFUNC_INIT
75 #ifdef CGXSHOWHIDESUPPORT
76 struct HideWindowActionMsg msg;
78 DEBUG_HIDEWINDOW(dprintf("HideWindow: Window 0x%lx\n", (ULONG) window));
80 SANITY_CHECK(window)
81 if (window->Flags & WFLG_BACKDROP) return;
83 msg.window = window;
84 DoASyncAction((APTR)int_hidewindow, &msg.msg, sizeof(msg), IntuitionBase);
85 #endif
87 #ifdef ChangeLayerVisibility
88 struct HideWindowActionMsg msg;
90 DEBUG_HIDEWINDOW(dprintf("HideWindow: Window 0x%lx\n", window));
92 msg.window = window;
93 DoASyncAction((APTR)int_hidewindow, &msg.msg, sizeof(msg), IntuitionBase);
94 #endif
96 AROS_LIBFUNC_EXIT
97 } /* HideWindow */
100 #ifdef CGXSHOWHIDESUPPORT
101 static VOID int_hidewindow(struct HideWindowActionMsg *msg,
102 struct IntuitionBase *IntuitionBase)
104 struct Window *window = msg->window;
105 struct Library *CGXSystemBase;
107 if (!window) return;
109 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
111 if (window->Flags & WFLG_BACKDROP) return;
113 if (((struct IntWindow *)(window))->specialflags & SPFLAG_NOICONIFY) return;
115 if ((CGXSystemBase = OpenLibrary("cgxsystem.library", 0)))
117 CGXHideWindow(window);
118 ((struct IntWindow *)(window))->specialflags |= SPFLAG_ICONIFIED;
119 CloseLibrary(CGXSystemBase);
122 #endif
124 #ifdef ChangeLayerVisibility
125 static VOID int_hidewindow(struct HideWindowActionMsg *msg,
126 struct IntuitionBase *IntuitionBase)
128 struct Window *window = msg->window;
129 struct Screen *screen;
131 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
133 screen = window->WScreen;
135 if (IsWindowVisible(window))
137 struct Requester *req;
139 LOCK_REFRESH(screen);
141 if (BLAYER(window))
143 ChangeLayerVisibility(BLAYER(window), FALSE);
145 ChangeLayerVisibility(WLAYER(window), FALSE);
147 for (req = window->FirstRequest; req; req = req->OlderRequest)
149 ChangeLayerVisibility(req->ReqLayer, FALSE);
152 UNLOCK_REFRESH(screen);
154 CheckLayers(screen, IntuitionBase);
157 #endif