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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2640>
This commit is contained in:
Carlos Garnacho 2022-09-23 15:53:19 +02:00 committed by Marge Bot
parent b85f85d665
commit bbf57d092c
4 changed files with 13 additions and 0 deletions

View File

@ -43,6 +43,8 @@ handle_hold_begin (MetaWaylandPointer *pointer,
serial = wl_display_next_serial (seat->wl_display); serial = wl_display_next_serial (seat->wl_display);
fingers = clutter_event_get_touchpad_gesture_finger_count (event); 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) wl_resource_for_each (resource, &pointer_client->hold_gesture_resources)
{ {
zwp_pointer_gesture_hold_v1_send_begin (resource, serial, 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, zwp_pointer_gesture_hold_v1_send_end (resource, serial,
time, cancelled); time, cancelled);
} }
pointer_client->active_touchpad_gesture = CLUTTER_NOTHING;
} }
static void static void

View File

@ -47,6 +47,8 @@ handle_pinch_begin (MetaWaylandPointer *pointer,
serial = wl_display_next_serial (seat->wl_display); serial = wl_display_next_serial (seat->wl_display);
fingers = clutter_event_get_touchpad_gesture_finger_count (event); 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) wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources)
{ {
zwp_pointer_gesture_pinch_v1_send_begin (resource, serial, 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, zwp_pointer_gesture_pinch_v1_send_end (resource, serial,
time, cancelled); time, cancelled);
} }
pointer_client->active_touchpad_gesture = CLUTTER_NOTHING;
} }
static void static void

View File

@ -47,6 +47,8 @@ handle_swipe_begin (MetaWaylandPointer *pointer,
serial = wl_display_next_serial (seat->wl_display); serial = wl_display_next_serial (seat->wl_display);
fingers = clutter_event_get_touchpad_gesture_finger_count (event); 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) wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
{ {
zwp_pointer_gesture_swipe_v1_send_begin (resource, serial, 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, zwp_pointer_gesture_swipe_v1_send_end (resource, serial,
time, cancelled); time, cancelled);
} }
pointer_client->active_touchpad_gesture = CLUTTER_NOTHING;
} }
static void static void

View File

@ -61,6 +61,7 @@ struct _MetaWaylandPointerClient
struct wl_list pinch_gesture_resources; struct wl_list pinch_gesture_resources;
struct wl_list hold_gesture_resources; struct wl_list hold_gesture_resources;
struct wl_list relative_pointer_resources; struct wl_list relative_pointer_resources;
ClutterEventType active_touchpad_gesture;
}; };
struct _MetaWaylandPointer struct _MetaWaylandPointer