Minor fixes to comments.
[AROS.git] / rom / intuition / windowtofront.c
blob6aa903ce49a2784011aa7c1d1398fea8cfabcec3
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$
6 Move window in front of all other windows.
7 */
9 #include <proto/layers.h>
10 #include "intuition_intern.h"
11 #include "inputhandler_actions.h"
12 #include "inputhandler_support.h"
14 struct WindowToFrontActionMsg
16 struct IntuiActionMsg msg;
17 struct Window *window;
20 static VOID int_windowtofront(struct WindowToFrontActionMsg *msg,
21 struct IntuitionBase *IntuitionBase);
23 /*****************************************************************************
25 NAME */
26 #include <intuition/intuition.h>
27 #include <proto/intuition.h>
29 AROS_LH1(void, WindowToFront,
31 /* SYNOPSIS */
32 AROS_LHA(struct Window *, window, A0),
34 /* LOCATION */
35 struct IntuitionBase *, IntuitionBase, 52, Intuition)
37 /* FUNCTION
38 Bring a window to the front (ie. before any other window).
40 INPUTS
41 window - Which window
43 RESULT
44 None.
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
54 INTERNALS
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct WindowToFrontActionMsg msg;
62 DEBUG_WINDOWTOFRONT(dprintf("WindowToFront: Window 0x%lx\n", window));
64 if (!window)
65 return;
67 msg.window = window;
68 DoASyncAction((APTR)int_windowtofront, &msg.msg, sizeof(msg), IntuitionBase);
70 AROS_LIBFUNC_EXIT
72 } /* WindowToFront */
75 static VOID int_windowtofront(struct WindowToFrontActionMsg *msg,
76 struct IntuitionBase *IntuitionBase)
78 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
79 struct Window *window = msg->window;
80 struct Layer *layer = WLAYER(window);
81 struct Screen *screen = window->WScreen;
82 struct Requester *req;
84 DEBUG_WINDOWTOFRONT(dprintf("IntWindowToFront: Window 0x%lx\n", window));
86 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
88 if (!(layer->Flags & LAYERBACKDROP))
90 LOCK_REFRESH(screen);
92 /* GZZ or regular window? */
93 if (BLAYER(window))
95 /* bring outer window to front first!! */
97 UpfrontLayer(0, BLAYER(window));
100 UpfrontLayer(0, layer);
102 for (req = window->FirstRequest; req; req = req->OlderRequest)
104 if (req->ReqLayer)
106 MoveLayerInFrontOf(req->ReqLayer, layer);
110 CheckLayers(screen, IntuitionBase);
112 UNLOCK_REFRESH(screen);
116 ((struct IntWindow *)(window))->specialflags &= ~SPFLAG_ICONIFIED;
117 /* window is not iconified anymore */
119 NotifyDepthArrangement(window, IntuitionBase);