mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 21:32:14 +00:00
wayland: Cancel active pointer gestures with wl_pointer.leave
There may be an active pointer gesture at the time of a focus change, in which case we should cancel it. Add the plumbing so that happens, by looking at the active MetaWaylandPointerClient gesture. Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5199 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2640>
This commit is contained in:
parent
57074463ab
commit
1023592f8a
@ -176,6 +176,30 @@ meta_wayland_pointer_client_is_empty (MetaWaylandPointerClient *pointer_client)
|
||||
wl_list_empty (&pointer_client->relative_pointer_resources));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_pointer_client_maybe_cancel_gesture (MetaWaylandPointer *pointer,
|
||||
MetaWaylandPointerClient *pointer_client,
|
||||
uint32_t serial)
|
||||
{
|
||||
switch (pointer_client->active_touchpad_gesture)
|
||||
{
|
||||
case CLUTTER_TOUCHPAD_SWIPE:
|
||||
meta_wayland_pointer_gesture_swipe_cancel (pointer, serial);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCHPAD_PINCH:
|
||||
meta_wayland_pointer_gesture_pinch_cancel (pointer, serial);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCHPAD_HOLD:
|
||||
meta_wayland_pointer_gesture_hold_cancel (pointer, serial);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MetaWaylandPointerClient *
|
||||
meta_wayland_pointer_get_pointer_client (MetaWaylandPointer *pointer,
|
||||
struct wl_client *client)
|
||||
@ -1014,6 +1038,10 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
||||
|
||||
if (pointer->focus_client)
|
||||
{
|
||||
meta_wayland_pointer_client_maybe_cancel_gesture (pointer,
|
||||
pointer->focus_client,
|
||||
serial);
|
||||
|
||||
meta_wayland_pointer_broadcast_leave (pointer,
|
||||
serial,
|
||||
pointer->focus_surface);
|
||||
|
Loading…
Reference in New Issue
Block a user