mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +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 */
|
/* Some tracking on gesture events */
|
||||||
guint gesture_n_fingers;
|
guint gesture_n_fingers;
|
||||||
gdouble gesture_scale;
|
gdouble gesture_scale;
|
||||||
|
|
||||||
|
GdkCursor *grab_cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkWaylandSeat, gdk_wayland_seat, GDK_TYPE_SEAT)
|
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)
|
if (device == wd->touch_master)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (wd->pointer_grab_window)
|
||||||
|
cursor = wd->grab_cursor;
|
||||||
|
|
||||||
/* Setting the cursor to NULL means that we should use
|
/* Setting the cursor to NULL means that we should use
|
||||||
* the default cursor
|
* the default cursor
|
||||||
*/
|
*/
|
||||||
@ -2458,6 +2463,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
|
|||||||
evtime,
|
evtime,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
g_set_object (&wayland_seat->grab_cursor, cursor);
|
||||||
g_set_object (&wayland_seat->cursor, cursor);
|
g_set_object (&wayland_seat->cursor, cursor);
|
||||||
gdk_wayland_device_update_window_cursor (wayland_seat);
|
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);;
|
GdkDisplay *display = gdk_seat_get_display (seat);;
|
||||||
GdkDeviceGrabInfo *grab;
|
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)
|
if (wayland_seat->master_pointer)
|
||||||
{
|
{
|
||||||
GdkWindow *focus, *prev_focus = NULL;
|
GdkWindow *focus, *prev_focus = NULL;
|
||||||
@ -2551,13 +2566,6 @@ gdk_wayland_seat_ungrab (GdkSeat *seat)
|
|||||||
if (grab)
|
if (grab)
|
||||||
grab->serial_end = grab->serial_start;
|
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 *
|
static GdkDevice *
|
||||||
|
Loading…
Reference in New Issue
Block a user