[mutter/wip/carlosg/cancel-pointer-gestures-on-unfocus: 2/4] wayland: Keep track of active pointer gestures
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/cancel-pointer-gestures-on-unfocus: 2/4] wayland: Keep track of active pointer gestures
- Date: Fri, 23 Sep 2022 14:05:52 +0000 (UTC)
commit 19ee1688623b7682c170bcc825fc126d494be46e
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Sep 23 15:53:19 2022 +0200
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.
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 4d24f73162..2bda793536 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 89d1ba634e..01eb97c729 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 1e34c4908c..e3f65bfc30 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 088312f2f5..5cd725db7f 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]