summaryrefslogtreecommitdiff
path: root/gdk/x11/gdkdisplay-x11.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-01-26 20:38:20 +0100
committerAlexander Larsson <alex@localhost.localdomain>2009-04-02 10:15:27 +0200
commit016c5fd081ae1137b1cc4016eb8515f3c934eafe (patch)
tree3753e9772f57610dde0e2ccd0d8ddb254e77c47a /gdk/x11/gdkdisplay-x11.c
parentd2c1c0a8db6fd01bda11e6592a41ea2dfe1b4396 (diff)
downloadgtk+-016c5fd081ae1137b1cc4016eb8515f3c934eafe.tar.gz
Track pointer grabs on Xserver time
After a successful grab/ungrab we wait for an xserver roundtrip until we change the tracked grab in GdkDisplay. This way that data is always up-to-date wrt events comming in.
Diffstat (limited to 'gdk/x11/gdkdisplay-x11.c')
-rw-r--r--gdk/x11/gdkdisplay-x11.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index a7f57aa61d..a05bc511ce 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -31,6 +31,7 @@
#include <glib.h>
#include "gdkx.h"
+#include "gdkasync.h"
#include "gdkdisplay.h"
#include "gdkdisplay-x11.h"
#include "gdkscreen.h"
@@ -591,6 +592,25 @@ _gdk_x11_display_is_root_window (GdkDisplay *display,
return FALSE;
}
+struct XPointerUngrabInfo {
+ GdkDisplay *display;
+ guint32 time;
+};
+
+static void
+pointer_ungrab_callback (gpointer _data)
+{
+ struct XPointerUngrabInfo *data = _data;
+
+ _gdk_display_unset_has_pointer_grab (data->display,
+ FALSE,
+ FALSE,
+ data->time);
+
+ g_free (data);
+}
+
+
#define XSERVER_TIME_IS_LATER(time1, time2) \
( (( time1 > time2 ) && ( time1 - time2 < ((guint32)-1)/2 )) || \
(( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 )) \
@@ -625,10 +645,16 @@ gdk_display_pointer_ungrab (GdkDisplay *display,
display->pointer_grab.time == GDK_CURRENT_TIME ||
!XSERVER_TIME_IS_LATER (display->pointer_grab.time, time_))
{
- _gdk_display_unset_has_pointer_grab (display,
- FALSE,
- FALSE,
- time_);
+ struct XPointerUngrabInfo *data;
+
+ data = g_new (struct XPointerUngrabInfo, 1);
+
+ data->display = GDK_DISPLAY_OBJECT (display_x11);
+ data->time = time_;
+
+ _gdk_x11_roundtrip_async (data->display,
+ pointer_ungrab_callback,
+ data);
}
}