Improvements to comments etc.
[AROS.git] / rom / intuition / endrequest.c
blob9d9dd0712b3944c1e2a2feb3909b88492beae157
1 /*
2 Copyright © 1995-2016, 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 "intuition_intern.h"
9 #include "inputhandler_actions.h"
11 #ifdef SKINS
12 # include "mosmisc.h"
13 #endif
15 struct EndRequestActionMsg
17 struct IntuiActionMsg msg;
18 struct Requester *requester;
19 struct Window *window;
22 static VOID int_endrequest(struct EndRequestActionMsg *msg,
23 struct IntuitionBase *IntuitionBase);
25 /*****************************************************************************
27 NAME */
28 #include <proto/intuition.h>
30 AROS_LH2(void, EndRequest,
32 /* SYNOPSIS */
33 AROS_LHA(struct Requester *, requester, A0),
34 AROS_LHA(struct Window * , window, A1),
36 /* LOCATION */
37 struct IntuitionBase *, IntuitionBase, 20, Intuition)
39 /* FUNCTION
40 Remove a requester from the specified window. Other open requesters
41 of this window stay alive.
43 INPUTS
44 requester - The requester to be deleted
45 window - The window to which the requester belongs
47 RESULT
48 None.
50 NOTES
52 EXAMPLE
54 BUGS
56 SEE ALSO
57 InitRequester(), Request()
59 INTERNALS
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct EndRequestActionMsg msg;
67 DEBUG_REQUEST(dprintf("EndRequest: req 0x%lx window 0x%lx\n", requester, window));
69 SANITY_CHECK(window)
70 SANITY_CHECK(requester)
72 msg.requester = requester;
73 msg.window = window;
75 DoSyncAction((APTR)int_endrequest, &msg.msg, IntuitionBase);
77 DEBUG_REQUEST(dprintf("EndRequest: removed successfully\n"));
79 AROS_LIBFUNC_EXIT
80 } /* EndRequest */
83 static VOID int_endrequest(struct EndRequestActionMsg *msg,
84 struct IntuitionBase *IntuitionBase)
86 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
87 struct Window *window = msg->window;
88 struct Requester *requester = msg->requester;
89 struct Requester *p = window->FirstRequest;
90 // struct IIHData *iihdata = (struct IIHData *)GetPrivIBase(IntuitionBase)->InputHandler->is_Data;
91 // int i;
93 //jDc: intuition68k doesn't care (tested)
94 //if (requester->Flags & REQACTIVE)
96 LOCKWINDOWLAYERS(window);
98 if (p == requester)
100 window->FirstRequest = requester->OlderRequest;//unliked
101 } else {
102 while (p && (p->OlderRequest != requester))
103 p = p->OlderRequest;
105 if (p)
107 p->OlderRequest = requester->OlderRequest;//unlinked
111 if (p)
113 struct Screen *screen = window->WScreen;
115 --window->ReqCount;
116 requester->Flags &= ~REQACTIVE;
118 LOCK_REFRESH(screen);
119 if (requester->ReqLayer) DeleteLayer(0, requester->ReqLayer);
120 requester->OlderRequest = 0;
121 requester->ReqLayer = 0; //sanity
122 CheckLayers(screen, IntuitionBase);
123 UNLOCK_REFRESH(screen);
125 ih_fire_intuimessage(window,
126 IDCMP_REQCLEAR,
128 window,
129 IntuitionBase);
134 UNLOCKWINDOWLAYERS(window);