[gtk+] x11: make _gdk_device_query_state report the master's device state



commit ea6ac66392269ae2f78ab76646bbae65bc61330c
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Fri May 17 13:28:04 2013 +0100

    x11: make _gdk_device_query_state report the master's device state
    
    Calling XIQueryPointer() on a slave device is going to trigger a
    BadDevice X error. So in case we query a slave device state, ask the
    master device instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700233

 gdk/x11/gdkdevice-xi2.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 9803273..9755a06 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -329,6 +329,16 @@ gdk_x11_device_xi2_query_state (GdkDevice        *device,
   display = gdk_window_get_display (window);
   default_screen = gdk_display_get_default_screen (display);
 
+  if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_SLAVE)
+    {
+      GdkDevice *master = gdk_device_get_associated_device (device);
+
+      if (master)
+        _gdk_device_query_state (master, window, root_window, child_window,
+                                 root_x, root_y, win_x, win_y, mask);
+      return;
+    }
+
   if (!GDK_X11_DISPLAY (display)->trusted_client ||
       !XIQueryPointer (GDK_WINDOW_XDISPLAY (window),
                        device_xi2->device_id,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]