[gtk+] wayland: Force the grab cursor while a grab is active
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Force the grab cursor while a grab is active
- Date: Fri, 8 Jan 2016 21:02:55 +0000 (UTC)
commit ad0fc8ae7e24f47120520072cd6089a2ad8d3b5f
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 8 21:45:03 2016 +0100
wayland: Force the grab cursor while a grab is active
When a cursor is specified in gdk_seat_grab(), the cursor is reverted as
soon as the pointer enters or leaves another window.
To avoid this issue, store the grab cursor separately, so we force-apply
it in ::set_window_cursor(). Also, unset early the seat info from the
window on gdk_seat_ungrab(), so the next time switch_to_pointer_grab()
happens we end up picking the cursor set for the window underneath the
pointer window.
Based on a patch by Olivier Fourdan <ofourdan redhat com>.
https://bugzilla.gnome.org/show_bug.cgi?id=760213
gdk/wayland/gdkdevice-wayland.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 969ed96..144413a 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -116,6 +116,8 @@ struct _GdkWaylandSeat
/* Some tracking on gesture events */
guint gesture_n_fingers;
gdouble gesture_scale;
+
+ GdkCursor *grab_cursor;
};
G_DEFINE_TYPE (GdkWaylandSeat, gdk_wayland_seat, GDK_TYPE_SEAT)
@@ -290,6 +292,9 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
if (device == wd->touch_master)
return;
+ if (wd->pointer_grab_window)
+ cursor = wd->grab_cursor;
+
/* Setting the cursor to NULL means that we should use
* the default cursor
*/
@@ -2458,6 +2463,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
evtime,
FALSE);
+ g_set_object (&wayland_seat->grab_cursor, cursor);
g_set_object (&wayland_seat->cursor, cursor);
gdk_wayland_device_update_window_cursor (wayland_seat);
}
@@ -2514,6 +2520,15 @@ gdk_wayland_seat_ungrab (GdkSeat *seat)
GdkDisplay *display = gdk_seat_get_display (seat);;
GdkDeviceGrabInfo *grab;
+ g_clear_object (&wayland_seat->grab_cursor);
+
+ if (wayland_seat->pointer_grab_window)
+ {
+ _gdk_wayland_window_set_grab_seat (wayland_seat->pointer_grab_window,
+ NULL);
+ wayland_seat->pointer_grab_window = NULL;
+ }
+
if (wayland_seat->master_pointer)
{
GdkWindow *focus, *prev_focus = NULL;
@@ -2551,13 +2566,6 @@ gdk_wayland_seat_ungrab (GdkSeat *seat)
if (grab)
grab->serial_end = grab->serial_start;
}
-
- if (wayland_seat->pointer_grab_window)
- {
- _gdk_wayland_window_set_grab_seat (wayland_seat->pointer_grab_window,
- NULL);
- wayland_seat->pointer_grab_window = NULL;
- }
}
static GdkDevice *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]