mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
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
This commit is contained in:
parent
23b629e27c
commit
ad0fc8ae7e
@ -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 *
|
||||
|
Loading…
Reference in New Issue
Block a user