grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / intuition / hidewindow.c
bloba972c4eb4c6db7d8ba376af51373b963ddd68145
1 /*
2 Copyright © 1995-2013, 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 struct HideWindowActionMsg
14 struct IntuiActionMsg msg;
15 struct Window *window;
18 static VOID int_hidewindow(struct HideWindowActionMsg *msg,
19 struct IntuitionBase *IntuitionBase);
21 /*****************************************************************************
23 NAME */
24 #include <proto/intuition.h>
26 AROS_LH1(BOOL, HideWindow,
28 /* SYNOPSIS */
29 AROS_LHA(struct Window *, window, A0),
31 /* LOCATION */
32 struct IntuitionBase *, IntuitionBase, 141, Intuition)
34 /* FUNCTION
35 Make a window invisible.
37 INPUTS
38 window - The window to affect.
40 RESULT
41 Success indicator. On AROS this is always TRUE.
43 NOTES
44 This function is source-compatible with AmigaOS v4.
45 This function is also present in MorphOS v50, however
46 considered private.
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 ShowWindow()
55 INTERNALS
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct HideWindowActionMsg msg;
63 DEBUG_HIDEWINDOW(dprintf("HideWindow: Window 0x%lx\n", (ULONG) window));
64 SANITY_CHECKR(window, FALSE)
66 #ifdef CGXSHOWHIDESUPPORT
67 if (window->Flags & WFLG_BACKDROP) return;
68 #endif
70 msg.window = window;
71 DoASyncAction((APTR)int_hidewindow, &msg.msg, sizeof(msg), IntuitionBase);
73 return TRUE;
75 AROS_LIBFUNC_EXIT
76 } /* HideWindow */
79 static VOID int_hidewindow(struct HideWindowActionMsg *msg,
80 struct IntuitionBase *IntuitionBase)
82 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
83 struct Window *window = msg->window;
84 #ifdef CGXSHOWHIDESUPPORT
85 struct Library *CGXSystemBase;
87 if (!window) return;
89 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
91 if (window->Flags & WFLG_BACKDROP) return;
93 if (((struct IntWindow *)(window))->specialflags & SPFLAG_NOICONIFY) return;
95 if ((CGXSystemBase = OpenLibrary("cgxsystem.library", 0)))
97 CGXHideWindow(window);
98 ((struct IntWindow *)(window))->specialflags |= SPFLAG_ICONIFIED;
99 CloseLibrary(CGXSystemBase);
101 #else
102 struct Screen *screen;
104 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
106 screen = window->WScreen;
108 if (IsWindowVisible(window))
110 struct Requester *req;
112 LOCK_REFRESH(screen);
114 if (BLAYER(window))
116 ChangeLayerVisibility(BLAYER(window), FALSE);
118 ChangeLayerVisibility(WLAYER(window), FALSE);
120 for (req = window->FirstRequest; req; req = req->OlderRequest)
122 ChangeLayerVisibility(req->ReqLayer, FALSE);
125 UNLOCK_REFRESH(screen);
127 CheckLayers(screen, IntuitionBase);
129 #endif