gliv-1.3.1
[gliv.git] / move_pointer.c
blob5c3378d08d9cd5c29b80f19488225d59f9cc83da
1 /*********************
2 * Extension to GDK. *
3 *********************/
5 #include <gdk/gdk.h>
6 #include <gdk/gdkx.h>
8 void move_pointer(gint dest_x, gint dest_y, gboolean discard_previous);
11 * Move the pointer to the (x, y) coordinates of the root window
12 * irrespective to the current pointer position.
14 void move_pointer(gint dest_x, gint dest_y, gboolean discard_previous)
16 Display *dpy;
17 glong event_mask;
18 XEvent xev;
20 dpy = GDK_DISPLAY();
22 if (discard_previous == TRUE) {
23 event_mask = PointerMotionMask | PointerMotionHintMask |
24 Button1MotionMask | Button2MotionMask | Button3MotionMask |
25 Button4MotionMask | Button5MotionMask | ButtonMotionMask;
27 while (XCheckMaskEvent(dpy, event_mask, &xev) == True);
30 XWarpPointer(dpy, None, GDK_ROOT_WINDOW(), 0, 0, 0, 0, dest_x, dest_y);