[gtk+] wayland: Ensure we get the master pointer on GdkDeviceManager::get_client_pointer



commit a72974252f32e69d7cd5d14df40568c9457f7abd
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 19 20:04:46 2015 +0100

    wayland: Ensure we get the master pointer on GdkDeviceManager::get_client_pointer
    
    Now that we have multiple master pointers, this call may pick the wrong one.
    Instead, pick the GdkWaylandDeviceData from the first device, and pick the
    master pointer from there.

 gdk/wayland/gdkdevice-wayland.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 60e209d..eefd38c 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2412,21 +2412,16 @@ static GdkDevice *
 gdk_wayland_device_manager_get_client_pointer (GdkDeviceManager *device_manager)
 {
   GdkWaylandDeviceManager *wayland_device_manager;
-  GList *l;
+  GdkWaylandDeviceData *wd;
+  GdkDevice *device;
 
   wayland_device_manager = GDK_WAYLAND_DEVICE_MANAGER (device_manager);
 
-  /* Find the first master pointer device */
-  for (l = wayland_device_manager->devices; l != NULL; l = l->next)
-    {
-      GdkDevice *device = l->data;
-
-      if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE &&
-          gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
-        return device;
-    }
+  /* Find the master pointer of the first GdkWaylandDeviceData we find */
+  device = wayland_device_manager->devices->data;
+  wd = GDK_WAYLAND_DEVICE (device)->device;
 
-  return NULL;
+  return wd->master_pointer;
 }
 
 static void


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