2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <proto/layers.h>
8 #include "intuition_intern.h"
9 #include "inputhandler_actions.h"
11 struct RequestActionMsg
13 struct IntuiActionMsg msg
;
14 struct Requester
*requester
;
15 struct Window
*window
;
19 static VOID
int_request(struct RequestActionMsg
*msg
,
20 struct IntuitionBase
*IntuitionBase
);
22 /*****************************************************************************
25 #include <proto/intuition.h>
27 AROS_LH2(BOOL
, Request
,
30 AROS_LHA(struct Requester
*, requester
, A0
),
31 AROS_LHA(struct Window
* , window
, A1
),
34 struct IntuitionBase
*, IntuitionBase
, 40, Intuition
)
37 Add a requester to specified window and display it.
40 requester - The requester to be displayed
41 window - The window to which the requester belongs
44 TRUE if requester was opened successfully, FALSE else.
53 EndRequest(), InitRequester()
59 *****************************************************************************/
63 struct RequestActionMsg msg
;
65 DEBUG_REQUEST(dprintf("Request: requester 0x%lx window 0x%lx\n", requester
, window
));
67 SANITY_CHECKR(window
,FALSE
)
68 SANITY_CHECKR(requester
,FALSE
)
71 msg
.requester
= requester
;
73 DoSyncAction((APTR
)int_request
, &msg
.msg
, IntuitionBase
);
75 DEBUG_REQUEST(dprintf("Request: requester (layer 0x%lx) setup %d\n",requester
->ReqLayer
,msg
.success
));
83 static VOID
int_request(struct RequestActionMsg
*msg
,
84 struct IntuitionBase
*IntuitionBase
)
86 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
87 struct Requester
*requester
= msg
->requester
;
88 struct Window
*window
= msg
->window
;
89 //ULONG layerflags = 0;
90 int left
, top
, right
, bottom
;
92 struct Gadget
*gadgets
;
93 int wleft
= window
->LeftEdge
+ window
->BorderLeft
;
94 int wtop
= window
->TopEdge
+ window
->BorderTop
;
95 int wright
= window
->LeftEdge
+ window
->Width
- window
->BorderRight
- 1;
96 int wbottom
= window
->TopEdge
+ window
->Height
- window
->BorderBottom
- 1;
98 if (requester
->Flags
& POINTREL
)
100 if (requester
== window
->DMRequest
)
102 left
= window
->LeftEdge
+ window
->MouseX
+ requester
->RelLeft
;
103 top
= window
->TopEdge
+ window
->MouseY
+ requester
->RelTop
;
104 if (left
+ requester
->Width
- 1 > wright
)
105 left
= wright
- requester
->Width
+ 1;
106 if (top
+ requester
->Height
- 1 > wbottom
)
107 top
= wbottom
- requester
->Height
+ 1;
111 left
= (wleft
+ wright
- requester
->Width
) >> 1;
112 top
= (wtop
+ wbottom
- requester
->Height
) >> 1;
113 left
+= requester
->RelLeft
;
114 top
+= requester
->RelTop
;
119 left
= wleft
+ requester
->LeftEdge
;
120 top
= wtop
+ requester
->TopEdge
;
125 else if (left
> wright
)
130 else if (top
> wbottom
)
133 right
= left
+ requester
->Width
- 1;
134 bottom
= top
+ requester
->Height
- 1;
139 if (bottom
> wbottom
)
142 requester
->ReqLayer
= NULL
;
144 if ((right
>= left
) && (bottom
>= top
))
146 requester
->ReqLayer
= CreateUpfrontHookLayer(
147 &window
->WScreen
->LayerInfo
148 , window
->WScreen
->RastPort
.BitMap
153 , (requester
->Flags
& SIMPLEREQ
? LAYERSIMPLE
: LAYERSMART
)
158 if (requester
->ReqLayer
)
160 requester
->ReqLayer
->Window
= window
;
161 requester
->RWindow
= window
;
163 requester
->LeftEdge
= left
- wleft
;
164 requester
->TopEdge
= top
- wtop
;
166 gadgets
= requester
->ReqGadget
;
167 requester
->ReqGadget
= NULL
;
169 requester
->OlderRequest
= window
->FirstRequest
;
170 window
->FirstRequest
= requester
;
172 requester
->Flags
|= REQACTIVE
;
174 AddGList(window
, gadgets
, 0, -1, requester
);
176 render_requester(requester
, IntuitionBase
);
182 msg
->success
= FALSE
;