From bbf57d092c58b85c69e719004991cb0871342bfe Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 23 Sep 2022 15:53:19 +0200 Subject: [PATCH] wayland: Keep track of active pointer gestures Only one of them may be active at a time, so track the type of active gesture so it can get properly cancelled. Part-of: --- src/wayland/meta-wayland-pointer-gesture-hold.c | 4 ++++ src/wayland/meta-wayland-pointer-gesture-pinch.c | 4 ++++ src/wayland/meta-wayland-pointer-gesture-swipe.c | 4 ++++ src/wayland/meta-wayland-pointer.h | 1 + 4 files changed, 13 insertions(+) diff --git a/src/wayland/meta-wayland-pointer-gesture-hold.c b/src/wayland/meta-wayland-pointer-gesture-hold.c index 4d24f7316..2bda79353 100644 --- a/src/wayland/meta-wayland-pointer-gesture-hold.c +++ b/src/wayland/meta-wayland-pointer-gesture-hold.c @@ -43,6 +43,8 @@ handle_hold_begin (MetaWaylandPointer *pointer, serial = wl_display_next_serial (seat->wl_display); fingers = clutter_event_get_touchpad_gesture_finger_count (event); + pointer_client->active_touchpad_gesture = event->type; + wl_resource_for_each (resource, &pointer_client->hold_gesture_resources) { zwp_pointer_gesture_hold_v1_send_begin (resource, serial, @@ -68,6 +70,8 @@ broadcast_end (MetaWaylandPointer *pointer, zwp_pointer_gesture_hold_v1_send_end (resource, serial, time, cancelled); } + + pointer_client->active_touchpad_gesture = CLUTTER_NOTHING; } static void diff --git a/src/wayland/meta-wayland-pointer-gesture-pinch.c b/src/wayland/meta-wayland-pointer-gesture-pinch.c index 89d1ba634..01eb97c72 100644 --- a/src/wayland/meta-wayland-pointer-gesture-pinch.c +++ b/src/wayland/meta-wayland-pointer-gesture-pinch.c @@ -47,6 +47,8 @@ handle_pinch_begin (MetaWaylandPointer *pointer, serial = wl_display_next_serial (seat->wl_display); fingers = clutter_event_get_touchpad_gesture_finger_count (event); + pointer_client->active_touchpad_gesture = event->type; + wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources) { zwp_pointer_gesture_pinch_v1_send_begin (resource, serial, @@ -96,6 +98,8 @@ broadcast_end (MetaWaylandPointer *pointer, zwp_pointer_gesture_pinch_v1_send_end (resource, serial, time, cancelled); } + + pointer_client->active_touchpad_gesture = CLUTTER_NOTHING; } static void diff --git a/src/wayland/meta-wayland-pointer-gesture-swipe.c b/src/wayland/meta-wayland-pointer-gesture-swipe.c index 1e34c4908..e3f65bfc3 100644 --- a/src/wayland/meta-wayland-pointer-gesture-swipe.c +++ b/src/wayland/meta-wayland-pointer-gesture-swipe.c @@ -47,6 +47,8 @@ handle_swipe_begin (MetaWaylandPointer *pointer, serial = wl_display_next_serial (seat->wl_display); fingers = clutter_event_get_touchpad_gesture_finger_count (event); + pointer_client->active_touchpad_gesture = event->type; + wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources) { zwp_pointer_gesture_swipe_v1_send_begin (resource, serial, @@ -92,6 +94,8 @@ broadcast_end (MetaWaylandPointer *pointer, zwp_pointer_gesture_swipe_v1_send_end (resource, serial, time, cancelled); } + + pointer_client->active_touchpad_gesture = CLUTTER_NOTHING; } static void diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h index 088312f2f..5cd725db7 100644 --- a/src/wayland/meta-wayland-pointer.h +++ b/src/wayland/meta-wayland-pointer.h @@ -61,6 +61,7 @@ struct _MetaWaylandPointerClient struct wl_list pinch_gesture_resources; struct wl_list hold_gesture_resources; struct wl_list relative_pointer_resources; + ClutterEventType active_touchpad_gesture; }; struct _MetaWaylandPointer