[gtk+] wayland: Ensure that _get_client_pointer returns a pointer



commit 17d1c3c8333af4c78fe095233a6fd888fafb2edd
Author: Rob Bradford <rob linux intel com>
Date:   Wed Jul 11 16:12:50 2012 +0100

    wayland: Ensure that _get_client_pointer returns a pointer
    
    The previous implementation could return a device that is a keyboard.

 gdk/wayland/gdkdevice-wayland.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 074f56f..6bd993a 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1320,9 +1320,20 @@ static GdkDevice *
 gdk_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager)
 {
   GdkDeviceManagerCore *device_manager_core;
+  GList *l;
 
   device_manager_core = (GdkDeviceManagerCore *) device_manager;
-  return device_manager_core->devices->data;
+
+  /* Find the first pointer device */
+  for (l = device_manager_core->devices; l != NULL; l = l->next)
+    {
+      GdkDevice *device = l->data;
+
+      if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE)
+        return device;
+    }
+
+  return NULL;
 }
 
 static void



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