Minor fixes to comments.
[AROS.git] / rom / intuition / showwindow.c
blobc517093b11387bcb9f60e69630a576ba3178a6f8
1 /*
2 Copyright © 1995-2011, 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 ShowWindowActionMsg
14 struct IntuiActionMsg msg;
15 struct Window *window;
18 static VOID int_showwindow(struct ShowWindowActionMsg *msg,
19 struct IntuitionBase *IntuitionBase);
21 /*****************************************************************************
23 NAME */
24 #include <proto/intuition.h>
26 AROS_LH2(BOOL, ShowWindow,
28 /* SYNOPSIS */
29 AROS_LHA(struct Window *, window, A0),
30 AROS_LHA(struct Window *, other, A1),
32 /* LOCATION */
33 struct IntuitionBase *, IntuitionBase, 140, Intuition)
35 /* FUNCTION
36 Make a window visible. This function does not bring the
37 window back into the visible area of the screen but rather
38 switches it into visible state.
40 INPUTS
41 window - The window to affect.
43 RESULT
44 Success indicator. On AROS it's always TRUE.
46 NOTES
47 This function is soure-compatible with AmigaOS v4.
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 HideWindow()
56 INTERNALS
58 HISTORY
60 *****************************************************************************/
62 AROS_LIBFUNC_INIT
64 struct ShowWindowActionMsg msg;
66 DEBUG_SHOWWINDOW(dprintf("ShowWindow: Window 0x%p\n", window));
67 SANITY_CHECKR(window, FALSE)
70 * TODO: in AmigaOS v4 we have additional 'other' parameter,
71 * and the window is moved in front of that window. Implement this.
74 msg.window = window;
75 DoASyncAction((APTR)int_showwindow, &msg.msg, sizeof(msg), IntuitionBase);
77 return TRUE;
79 AROS_LIBFUNC_EXIT
80 } /* ShowWindow */
82 static VOID int_showwindow(struct ShowWindowActionMsg *msg,
83 struct IntuitionBase *IntuitionBase)
85 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
86 struct Window *window = msg->window;
87 #ifdef CGXSHOWHIDESUPPORT
88 struct Library *CGXSystemBase;
90 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
92 SANITY_CHECK(window)
93 if ((CGXSystemBase = OpenLibrary("cgxsystem.library", 0)))
95 CGXShowWindow(window);
96 ((struct IntWindow *)(window))->specialflags &= ~SPFLAG_ICONIFIED;
97 CloseLibrary(CGXSystemBase);
98 ActivateWindow(window);
100 #else
101 struct Screen *screen;
103 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
104 screen = window->WScreen;
106 if (!IsWindowVisible(window))
108 struct Requester *req;
110 LOCK_REFRESH(screen);
112 if (BLAYER(window))
114 ChangeLayerVisibility(BLAYER(window), TRUE);
116 ChangeLayerVisibility(WLAYER(window), TRUE);
118 for (req = window->FirstRequest; req; req = req->OlderRequest)
120 ChangeLayerVisibility(req->ReqLayer, TRUE);
123 CheckLayers(screen, IntuitionBase);
125 UNLOCK_REFRESH(screen);
129 #endif