Check for SYS/GL during library init. Reason is that
[AROS.git] / rom / intuition / changewindowbox.c
blob14e8ec7074419e0703b987273e96a07cc2718a6e
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$
6 Change position and size of a window.
7 */
9 #include "intuition_intern.h"
10 #include "inputhandler_actions.h"
12 struct ChangeWindowBoxActionMsg
14 struct IntuiActionMsg msg;
15 struct Window *window;
16 LONG left;
17 LONG top;
18 LONG width;
19 LONG height;
22 static VOID int_changewindowbox(struct ChangeWindowBoxActionMsg *msg,
23 struct IntuitionBase *IntuitionBase);
25 /*****************************************************************************
27 NAME */
28 #include <proto/intuition.h>
30 AROS_LH5(void, ChangeWindowBox,
32 /* SYNOPSIS */
33 AROS_LHA(struct Window *, window, A0),
34 AROS_LHA(LONG , left, D0),
35 AROS_LHA(LONG , top, D1),
36 AROS_LHA(LONG , width, D2),
37 AROS_LHA(LONG , height, D3),
39 /* LOCATION */
40 struct IntuitionBase *, IntuitionBase, 81, Intuition)
42 /* FUNCTION
43 Set the new position and size of a window in one call.
45 INPUTS
46 window - Change this window
47 left, top - New position
48 width, height - New size
50 RESULT
52 NOTES
53 This call is deferred. Wait() for IDCMP_CHANGEWINDOW if your
54 program depends on the new size.
56 EXAMPLE
58 BUGS
60 SEE ALSO
62 INTERNALS
64 *****************************************************************************/
66 AROS_LIBFUNC_INIT
68 struct ChangeWindowBoxActionMsg msg;
70 DEBUG_CHANGEWINDOWBOX(dprintf("ChangeWindowBox: Window 0x%lx Left %d Top %d Width %d Height %d\n",
71 window, left, top, width, height));
73 if (!window)
74 return;
76 EXTENDWORD(left);
77 EXTENDWORD(top);
78 EXTENDWORD(width);
79 EXTENDWORD(height);
81 msg.window = window;
82 msg.left = left;
83 msg.top = top;
84 msg.width = width;
85 msg.height = height;
87 DoASyncAction((APTR)int_changewindowbox, &msg.msg, sizeof(msg), IntuitionBase);
88 // DoSyncAction((APTR)int_changewindowbox, &msg.msg, IntuitionBase);
90 AROS_LIBFUNC_EXIT
92 } /* ChangeWindowBox */
95 static VOID int_changewindowbox(struct ChangeWindowBoxActionMsg *msg,
96 struct IntuitionBase *IntuitionBase)
98 struct Window *window = msg->window;
100 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
102 if (window->Flags & WFLG_SIZEGADGET)
104 if (msg->width < window->MinWidth) msg->width = window->MinWidth;
105 if (msg->width > (UWORD)window->MaxWidth) msg->width = (UWORD)window->MaxWidth;
107 if (msg->width > window->WScreen->Width) msg->width = window->WScreen->Width;
109 if (window->Flags & WFLG_SIZEGADGET)
111 if (msg->height < window->MinHeight) msg->height = window->MinHeight;
112 if (msg->height > (UWORD)window->MaxHeight) msg->height = (UWORD)window->MaxHeight;
114 if (msg->height > window->WScreen->Height) msg->height = window->WScreen->Height;
116 DoMoveSizeWindow(window, msg->left, msg->top, msg->width, msg->height, TRUE, IntuitionBase);