]> Pileus Git - ~andy/gtk/commitdiff
wayland: Set a default cursor when the window cursor is set to NULL
authorRob Bradford <rob@linux.intel.com>
Thu, 5 Jan 2012 16:32:09 +0000 (16:32 +0000)
committerRob Bradford <rob@linux.intel.com>
Thu, 5 Jan 2012 17:39:14 +0000 (17:39 +0000)
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

index 5ef851000c7d6961a5442112d04bb37bef99b481..d14ec65e2338903e4e89751b80a7ed4e56736e55 100644 (file)
@@ -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