From ff016a7857dad6fe5463a6bac20b4f4b54952b39 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 5 Jan 2012 16:32:09 +0000 Subject: [PATCH] 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 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 5ef851000c..d14ec65e23 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