[gtk+] wayland: Add internal gdk_wayland_seat_set_global_cursor()



commit 0747a60129777ec44ed1053df16823d5eeb63594
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jan 13 20:57:47 2016 +0100

    wayland: Add internal gdk_wayland_seat_set_global_cursor()
    
    This can be used for cases (like DnD) where there isn't necessarily
    a grab, but we want a global pointer cursor.

 gdk/wayland/gdkdevice-wayland.c  |   19 +++++++++++++++++--
 gdk/wayland/gdkprivate-wayland.h |    3 +++
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 1afb9b0..43a8690 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -306,7 +306,7 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
   if (device == wd->touch_master)
     return;
 
-  if (wd->pointer_grab_window)
+  if (wd->grab_cursor)
     cursor = wd->grab_cursor;
 
   /* Setting the cursor to NULL means that we should use
@@ -2685,7 +2685,7 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
                                     evtime,
                                     FALSE);
 
-      g_set_object (&wayland_seat->grab_cursor, cursor);
+      gdk_wayland_seat_set_global_cursor (seat, cursor);
       g_set_object (&wayland_seat->cursor, cursor);
       gdk_wayland_device_update_window_cursor (wayland_seat);
     }
@@ -3066,6 +3066,21 @@ gdk_wayland_device_unset_touch_grab (GdkDevice        *gdk_device,
   _gdk_wayland_display_deliver_event (device->display, event);
 }
 
+void
+gdk_wayland_seat_set_global_cursor (GdkSeat   *seat,
+                                    GdkCursor *cursor)
+{
+  GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
+  GdkDevice *pointer;
+
+  pointer = gdk_seat_get_pointer (seat);
+
+  g_set_object (&wayland_seat->grab_cursor, cursor);
+  gdk_wayland_device_set_window_cursor (pointer,
+                                        gdk_wayland_device_get_focus (pointer),
+                                        NULL);
+}
+
 struct wl_data_device *
 gdk_wayland_device_get_data_device (GdkDevice *gdk_device)
 {
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index cb8a66a..23125cb 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -264,4 +264,7 @@ EGLSurface gdk_wayland_window_get_egl_surface (GdkWindow *window,
 EGLSurface gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
                                                     EGLConfig config);
 
+void gdk_wayland_seat_set_global_cursor (GdkSeat   *seat,
+                                         GdkCursor *cursor);
+
 #endif /* __GDK_PRIVATE_WAYLAND_H__ */


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