Added 'Resident' field to ensure that the handler is included in the
[AROS.git] / rom / intuition / endrequest.c
blobe005533fd0c7be482606f1dd77abda8806ce7294
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 "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.
41 Other open requesters 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 HISTORY
63 *****************************************************************************/
65 AROS_LIBFUNC_INIT
67 struct EndRequestActionMsg msg;
69 DEBUG_REQUEST(dprintf("EndRequest: req 0x%lx window 0x%lx\n", requester, window));
71 SANITY_CHECK(window)
72 SANITY_CHECK(requester)
74 msg.requester = requester;
75 msg.window = window;
77 DoSyncAction((APTR)int_endrequest, &msg.msg, IntuitionBase);
79 DEBUG_REQUEST(dprintf("EndRequest: removed succesfuly\n"));
81 AROS_LIBFUNC_EXIT
82 } /* EndRequest */
85 static VOID int_endrequest(struct EndRequestActionMsg *msg,
86 struct IntuitionBase *IntuitionBase)
88 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
89 struct Window *window = msg->window;
90 struct Requester *requester = msg->requester;
91 struct Requester *p = window->FirstRequest;
92 // struct IIHData *iihdata = (struct IIHData *)GetPrivIBase(IntuitionBase)->InputHandler->is_Data;
93 // int i;
95 //jDc: intuition68k doesn't care (tested)
96 //if (requester->Flags & REQACTIVE)
98 LOCKWINDOWLAYERS(window);
100 if (p == requester)
102 window->FirstRequest = requester->OlderRequest;//unliked
103 } else {
104 while (p && (p->OlderRequest != requester))
105 p = p->OlderRequest;
107 if (p)
109 p->OlderRequest = requester->OlderRequest;//unlinked
113 if (p)
115 struct Screen *screen = window->WScreen;
117 --window->ReqCount;
118 requester->Flags &= ~REQACTIVE;
120 LOCK_REFRESH(screen);
121 if (requester->ReqLayer) DeleteLayer(0, requester->ReqLayer);
122 requester->OlderRequest = 0;
123 requester->ReqLayer = 0; //sanity
124 CheckLayers(screen, IntuitionBase);
125 UNLOCK_REFRESH(screen);
127 ih_fire_intuimessage(window,
128 IDCMP_REQCLEAR,
130 window,
131 IntuitionBase);
136 UNLOCKWINDOWLAYERS(window);