Updated Sourceforge username and host.
[tangerine.git] / rom / intuition / windowtofront.c
blobecb15f931bdd00df3ddcd3b9fe4dd43ecdbb609c
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$
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 Window *window = msg->window;
79 struct Layer *layer = WLAYER(window);
80 struct Screen *screen = window->WScreen;
81 struct Requester *req;
83 DEBUG_WINDOWTOFRONT(dprintf("IntWindowToFront: Window 0x%lx\n", window));
85 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
87 if (!(layer->Flags & LAYERBACKDROP))
89 LOCK_REFRESH(screen);
91 /* GZZ or regular window? */
92 if (BLAYER(window))
94 /* bring outer window to front first!! */
96 UpfrontLayer(NULL, BLAYER(window));
99 UpfrontLayer(NULL, layer);
101 for (req = window->FirstRequest; req; req = req->OlderRequest)
103 if (req->ReqLayer)
105 MoveLayerInFrontOf(req->ReqLayer, layer);
109 CheckLayers(screen, IntuitionBase);
111 UNLOCK_REFRESH(screen);
115 ((struct IntWindow *)(window))->specialflags &= ~SPFLAG_ICONIFIED;
116 /* window is not iconified anymore */
118 NotifyDepthArrangement(window, IntuitionBase);