[mutter/wip/carlosg/cancel-pointer-gestures-on-unfocus: 25/25] wayland: Cancel active pointer gestures with wl_pointer.leave
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/cancel-pointer-gestures-on-unfocus: 25/25] wayland: Cancel active pointer gestures with wl_pointer.leave
- Date: Thu, 29 Sep 2022 12:36:56 +0000 (UTC)
commit 1023592f8a3c3c0420d2be6f2ec009e6ea3219db
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Sep 23 15:56:08 2022 +0200
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>
src/wayland/meta-wayland-pointer.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 94e76677b6..d000ccfd86 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]