[gtk+] wayland: Fix initial cursor



commit e9629a51493926013bd259458460fce02157f66c
Author: Benjamin Otte <otte redhat com>
Date:   Wed Nov 15 19:05:48 2017 +0100

    wayland: Fix initial cursor
    
    Make sure the initial cursor isn't random which would happen due to an
    early exit when cursor == pointer->cursor triggered because both were
    NULL.

 gdk/wayland/gdkdevice-wayland.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index c2bba21..3c24ac2 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -28,6 +28,7 @@
 #include "gdkseat-wayland.h"
 #include "gdkwayland.h"
 #include "gdkkeysyms.h"
+#include "gdkcursorprivate.h"
 #include "gdkdeviceprivate.h"
 #include "gdkdevicepadprivate.h"
 #include "gdkdevicetoolprivate.h"
@@ -501,18 +502,24 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
   if (seat->grab_cursor)
     cursor = seat->grab_cursor;
 
-  if (cursor == pointer->cursor)
-    return;
+  if (cursor == NULL)
+    cursor = gdk_cursor_new_from_name ("default", NULL);
+  else
+    cursor = g_object_ref (cursor);
+
+  if (pointer->cursor != NULL &&
+      gdk_cursor_equal (cursor, pointer->cursor))
+    {
+      g_object_unref (cursor);
+      return;
+    }
 
   gdk_wayland_pointer_stop_cursor_animation (pointer);
 
   if (pointer->cursor)
     g_object_unref (pointer->cursor);
 
-  if (cursor == NULL)
-    pointer->cursor = gdk_cursor_new_from_name ("default", NULL);
-  else
-    pointer->cursor = g_object_ref (cursor);
+  pointer->cursor = cursor;
 
   gdk_wayland_device_update_window_cursor (device);
 }


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