use the cached method id's to improve performance.
[AROS.git] / rom / intuition / movewindow.c
blob11cd70b390e0a45aac11bc032cc75d81af638d8f
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 Move a window around on the screen.
7 */
9 #include "intuition_intern.h"
10 #include "inputhandler_actions.h"
12 struct MoveWindowActionMsg
14 struct IntuiActionMsg msg;
15 struct Window *window;
16 LONG dx;
17 LONG dy;
20 static VOID int_movewindow(struct MoveWindowActionMsg *msg,
21 struct IntuitionBase *IntuitionBase);
24 /*****************************************************************************
26 NAME */
27 #include <proto/intuition.h>
29 AROS_LH3(void, MoveWindow,
31 /* SYNOPSIS */
32 AROS_LHA(struct Window *, window, A0),
33 AROS_LHA(LONG , dx, D0),
34 AROS_LHA(LONG , dy, D1),
36 /* LOCATION */
37 struct IntuitionBase *, IntuitionBase, 28, Intuition)
39 /* FUNCTION
40 Change the position of a window on the screen.
42 INPUTS
43 window - Move this window
44 dx, dy - Move it that many pixels along the axis (right, down)
46 RESULT
47 The window will move when the next input event will be received.
49 NOTES
51 EXAMPLE
53 BUGS
55 SEE ALSO
56 SizeWindow()
58 INTERNALS
60 *****************************************************************************/
62 AROS_LIBFUNC_INIT
64 EXTENDWORD(dx);
65 EXTENDWORD(dy);
67 if (window && (dx || dy))
69 struct MoveWindowActionMsg msg;
71 msg.window = window;
72 msg.dx = dx;
73 msg.dy = dy;
75 DoASyncAction((APTR)int_movewindow, &msg.msg, sizeof(msg), IntuitionBase);
76 //DoSyncAction((APTR)int_movewindow, &msg.msg, IntuitionBase);
79 AROS_LIBFUNC_EXIT
80 } /* MoveWindow */
82 static VOID int_movewindow(struct MoveWindowActionMsg *msg,
83 struct IntuitionBase *IntuitionBase)
85 struct Window *window = msg->window;
87 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
89 DoMoveSizeWindow(window,
90 window->LeftEdge + msg->dx, window->TopEdge + msg->dy,
91 window->Width, window->Height, FALSE, IntuitionBase);