summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2015-11-20 16:49:12 +0800
committerMatthias Clasen <mclasen@redhat.com>2015-11-20 11:59:46 -0500
commitdc65abc44c403e980b0f74815d63d979d8f663d9 (patch)
treed1bca6375892f0e8f6a722dc9d8fbe5b280bf88e
parentcf7bb4f2aa18255d52ba97bd12a8930b3b879fc5 (diff)
downloadgtk+-dc65abc44c403e980b0f74815d63d979d8f663d9.tar.gz
wayland: Set a null cursor surface when cursor buffer is null
If the buffer of a cursor is NULL, for example if its an empty cursor, just set the cursor surface to NULL as well. Not doing this we'll use uninitialized hotspot coordinates, dimensions and scales. https://bugzilla.gnome.org/show_bug.cgi?id=758025
-rw-r--r--gdk/wayland/gdkdevice-wayland.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 74aba25493..2f86ee13c1 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -225,16 +225,27 @@ gdk_wayland_device_update_window_cursor (GdkWaylandDeviceData *wd)
if (!wd->wl_pointer)
return retval;
- wl_pointer_set_cursor (wd->wl_pointer,
- wd->enter_serial,
- wd->pointer_surface,
- x, y);
if (buffer)
{
wl_surface_attach (wd->pointer_surface, buffer, 0, 0);
wl_surface_set_buffer_scale (wd->pointer_surface, scale);
wl_surface_damage (wd->pointer_surface, 0, 0, w, h);
wl_surface_commit (wd->pointer_surface);
+
+ wl_pointer_set_cursor (wd->wl_pointer,
+ wd->enter_serial,
+ wd->pointer_surface,
+ x, y);
+ }
+ else
+ {
+ wl_pointer_set_cursor (wd->wl_pointer,
+ wd->enter_serial,
+ NULL,
+ 0, 0);
+
+ wl_surface_attach (wd->pointer_surface, NULL, 0, 0);
+ wl_surface_commit (wd->pointer_surface);
}
if (wd->grab_cursor)