_screen is only valid between show/hide.
[AROS.git] / rom / intuition / setdmrequest.c
blob440ba590d092b8cfc8f8cf8d1e43b0c6f1711360
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
8 #include "inputhandler_actions.h"
10 struct SetDMRequestActionMsg
12 struct IntuiActionMsg msg;
13 struct Window *window;
14 struct Requester *dmrequest;
15 BOOL success;
18 static VOID int_setdmrequest(struct SetDMRequestActionMsg *msg,
19 struct IntuitionBase *IntuitionBase);
21 /*****************************************************************************
23 NAME */
24 #include <proto/intuition.h>
26 AROS_LH2(BOOL, SetDMRequest,
28 /* SYNOPSIS */
29 AROS_LHA(struct Window * , window, A0),
30 AROS_LHA(struct Requester *, dmrequest, A1),
32 /* LOCATION */
33 struct IntuitionBase *, IntuitionBase, 43, Intuition)
35 /* FUNCTION
36 Try to set the DMRequest of a window. A DMRequest is a requester that
37 appears if the user double-clicks with the menu button.
39 The new DMRequest will only be set if the old DMRequest is not in use.
40 The official way to change the DMRequest is to call ClearDMRequest()
41 until it returns TRUE and then call SetDMRequest().
43 INPUTS
44 window - The window from which the DMRequest is to be set
45 dmrequest - Pointer to the requester
47 RESULT
48 TRUE if old DMRequest was not in use and therefore changed to
49 the new one, or FALSE if the old DMRequest was in use and could
50 not be set to the new one.
52 NOTES
53 If the DMRequest has the POINTREL flag set, the DMR will show up
54 as close to the pointer as possible. The RelLeft/Top fields are
55 used to fine-tune the positioning.
57 EXAMPLE
59 BUGS
61 SEE ALSO
62 ClearDMRequest(), Request()
64 INTERNALS
66 *****************************************************************************/
68 AROS_LIBFUNC_INIT
70 struct SetDMRequestActionMsg msg;
72 SANITY_CHECKR(window,FALSE)
73 SANITY_CHECKR(dmrequest,FALSE)
75 msg.window = window;
76 msg.dmrequest = dmrequest;
78 DoSyncAction((APTR)int_setdmrequest, &msg.msg, IntuitionBase);
80 return msg.success;
82 AROS_LIBFUNC_EXIT
83 } /* SetDMRequest */
86 static VOID int_setdmrequest(struct SetDMRequestActionMsg *msg,
87 struct IntuitionBase *IntuitionBase)
89 struct Window *window = msg->window;
90 struct Requester *dmrequest = msg->dmrequest;
91 LONG result;
93 if (window->DMRequest && window->DMRequest->Flags & REQACTIVE)
95 result = FALSE;
97 else
99 window->DMRequest = dmrequest;
100 result = TRUE;
103 msg->success = result;