diff -ru gtk+-1.2.10_orig/gdk/gdk.h gtk+-1.2.10/gdk/gdk.h --- gtk+-1.2.10_orig/gdk/gdk.h Mon Apr 15 12:55:51 2002 +++ gtk+-1.2.10/gdk/gdk.h Sat Apr 20 01:57:19 2002 @@ -360,6 +360,11 @@ gint *x, gint *y, GdkModifierType *mask); +GdkWindow* gdk_window_set_pointer (GdkWindow *window, + gint x, + gint y); +GdkWindow* gdk_window_last_timestamp_processed (GdkWindow *window, + guint32 *time); GdkWindow* gdk_window_get_parent (GdkWindow *window); GdkWindow* gdk_window_get_toplevel (GdkWindow *window); GList* gdk_window_get_children (GdkWindow *window); diff -ru gtk+-1.2.10_orig/gdk/gdkwindow.c gtk+-1.2.10/gdk/gdkwindow.c --- gtk+-1.2.10_orig/gdk/gdkwindow.c Mon Apr 15 12:55:51 2002 +++ gtk+-1.2.10/gdk/gdkwindow.c Mon Apr 22 21:51:47 2002 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "gdk.h" #include "config.h" @@ -1659,6 +1660,92 @@ *mask = xmask; return return_val; +} + +GdkWindow* +gdk_window_set_pointer (GdkWindow *window, + gint x, + gint y) +{ + GdkWindowPrivate *private; + + if (!window) + window = (GdkWindow*) &gdk_root_parent; + + private = (GdkWindowPrivate*) window; + + if (!private->destroyed) { + XWarpPointer (private->xdisplay, None, private->xwindow, 0, 0, 0, 0, x, y); + } + + return window; +} + +static Atom timestamp_prop_atom; +static Bool timestamp_prop_atom_init = False; + +static Bool +timestamp_predicate (Display *display, + XEvent *xevent, + XPointer arg) +{ + Window xwindow = GPOINTER_TO_UINT (arg); + + if (xevent->type == PropertyNotify && + xevent->xproperty.window == xwindow && + xevent->xproperty.atom == timestamp_prop_atom) + return True; + + return False; +} + +GdkWindow* +gdk_window_last_timestamp_processed(GdkWindow *window, guint32 *time) +{ +#if 0 + /* + * this is what I want, but gdk apps are no Xt apps, so + * XtLastTimestampProcessed failes. + */ + GdkWindowPrivate *private; + + if (!window) + window = (GdkWindow*) &gdk_root_parent; + + private = (GdkWindowPrivate*) window; + + if (!private->destroyed) { + *time = XtLastTimestampProcessed(private->xdisplay); + } else { + *time = 0L; + } +#else + /* + * This one is backported from gtk+-2.0.2 + */ + GdkWindowPrivate *private; + XEvent xevent; + guchar c = 'a'; + + if (!window) + window = (GdkWindow*) &gdk_root_parent; + + private = (GdkWindowPrivate*) window; + gdk_window_set_events(window, gdk_window_get_events(window)|GDK_PROPERTY_CHANGE_MASK); + if (timestamp_prop_atom_init == False) { + timestamp_prop_atom = XInternAtom(private->xdisplay, "GET_SOME_TIMESTAMP", False); + timestamp_prop_atom_init = True; + } + XChangeProperty (private->xdisplay, private->xwindow, + timestamp_prop_atom, timestamp_prop_atom, 8, PropModeReplace, &c, 1); + + XIfEvent (private->xdisplay, &xevent, + timestamp_predicate, GUINT_TO_POINTER(private->xwindow)); + + *time = xevent.xproperty.time; + +#endif + return window; } GdkWindow*