[gtk+] wayland: Set a default cursor when the window cursor is set to NULL



commit ff016a7857dad6fe5463a6bac20b4f4b54952b39
Author: Rob Bradford <rob linux intel com>
Date:   Thu Jan 5 16:32:09 2012 +0000

    wayland: Set a default cursor when the window cursor is set to NULL
    
    This change follows on from a change in semantics in Wayland where calling
    wl_input_device_attach with nil would make the compositor set the pointer
    sprite to it's default cursor sprite.

 gdk/wayland/gdkdevice-wayland.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 5ef8510..d14ec65 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -139,14 +139,20 @@ gdk_device_core_set_window_cursor (GdkDevice *device,
   int x, y;
 
   if (cursor)
+    g_object_ref (cursor);
+
+  /* Setting the cursor to NULL means that we should use the default cursor */
+  if (!cursor)
     {
-      buffer = _gdk_wayland_cursor_get_buffer(cursor, &x, &y);
-      wl_input_device_attach(wd->device, wd->time, buffer, x, y);
-    }
-  else
-    {
-      wl_input_device_attach(wd->device, wd->time, NULL, 0, 0);
+      /* FIXME: Is this the best sensible default ? */
+      cursor = _gdk_wayland_display_get_cursor_for_type (device->display,
+                                                         GDK_LEFT_PTR);
     }
+
+  buffer = _gdk_wayland_cursor_get_buffer(cursor, &x, &y);
+  wl_input_device_attach(wd->device, wd->time, buffer, x, y);
+
+  g_object_unref (cursor);
 }
 
 static void



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