Minor fixes to comments.
[AROS.git] / rom / intuition / windowtoback.c
blob8a8068e0418943a293c7b777d0bb508af482de05
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 behind all other windows.
7 */
9 #include <proto/layers.h>
10 #include "intuition_intern.h"
11 #include "inputhandler_actions.h"
13 struct WindowToBackActionMsg
15 struct IntuiActionMsg msg;
16 struct Window *window;
19 static VOID int_windowtoback(struct WindowToBackActionMsg *msg,
20 struct IntuitionBase *IntuitionBase);
22 /*****************************************************************************
24 NAME */
25 #include <intuition/intuition.h>
26 #include <proto/intuition.h>
28 AROS_LH1(void, WindowToBack,
30 /* SYNOPSIS */
31 AROS_LHA(struct Window *, window, A0),
33 /* LOCATION */
34 struct IntuitionBase *, IntuitionBase, 51, Intuition)
36 /* FUNCTION
37 Bring a window to the back (ie. behind any other window).
39 INPUTS
40 window - Which window
42 RESULT
43 None.
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
53 INTERNALS
55 HISTORY
56 29-10-95 digulla automatically created from
57 intuition_lib.fd and clib/intuition_protos.h
59 *****************************************************************************/
61 AROS_LIBFUNC_INIT
63 struct WindowToBackActionMsg msg;
65 DEBUG_WINDOWTOBACK(dprintf("WindowToBack: Window 0x%lx\n", window));
67 if (!window)
68 return;
70 msg.window = window;
71 DoASyncAction((APTR)int_windowtoback, &msg.msg, sizeof(msg), IntuitionBase);
73 AROS_LIBFUNC_EXIT
75 } /* WindowToBack */
78 static VOID int_windowtoback(struct WindowToBackActionMsg *msg,
79 struct IntuitionBase *IntuitionBase)
81 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
82 struct Window *window = msg->window;
83 struct Layer *layer = WLAYER(window);
84 struct Screen *screen = window->WScreen;
85 struct Requester *req;
87 DEBUG_WINDOWTOBACK(dprintf("IntWindowToBack: Window 0x%lx\n", window));
89 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
91 if (!(layer->Flags & LAYERBACKDROP))
93 LOCK_REFRESH(screen);
95 for (req = window->FirstRequest; req; req = req->OlderRequest)
97 if (req->ReqLayer)
99 BehindLayer(0, req->ReqLayer);
103 BehindLayer(0, layer);
105 /* GZZ window or regular window? */
106 if (BLAYER(window))
108 /* move outer window behind! */
109 /* attention: layer->back would not be valid as
110 layer already moved!!
112 BehindLayer(0, BLAYER(window));
115 CheckLayers(screen, IntuitionBase);
117 UNLOCK_REFRESH(screen);
120 NotifyDepthArrangement(window, IntuitionBase);