From a72974252f32e69d7cd5d14df40568c9457f7abd Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 19 Nov 2015 20:04:46 +0100 Subject: [PATCH] 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 file changed, 6 insertions(+), 11 deletions(-) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 60e209d7f7..eefd38cbc9 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; + /* Find the master pointer of the first GdkWaylandDeviceData we find */ + device = wayland_device_manager->devices->data; + wd = GDK_WAYLAND_DEVICE (device)->device; - if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE && - gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER) - return device; - } - - return NULL; + return wd->master_pointer; } static void