From 58bcd30ee6ff321b58674ccf47d1a8440dca2c94 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 9 Mar 2022 23:00:40 +0100 Subject: [PATCH] clutter: Always unregister point on GRAB_NOTIFY leave event The ClutterGestureAction base code would correctly try to cancel a gesture if it would receive GRAB_NOTIFY leave events (that would indicate other portions of the actor tree stole input away from the gesture actor), but it would mistakenly do so only if the gesture was already initiated, possibly leaving stale point information if the gesture collected input but didn't initiate yet. This could be indirectly seen clicking with the mouse on OSK keys with no motions in between, clicks would accumulate on the swipeTracker gestures until the trigger point, so the third click could drag the workspaces. We do always want to unregister the related device/sequence here, do that while still cancelling any already initiated gesture. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1907 Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4987 Part-of: --- clutter/clutter/clutter-gesture-action.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clutter/clutter/clutter-gesture-action.c b/clutter/clutter/clutter-gesture-action.c index a57faa74b..bcca5a08d 100644 --- a/clutter/clutter/clutter-gesture-action.c +++ b/clutter/clutter/clutter-gesture-action.c @@ -380,12 +380,15 @@ clutter_gesture_action_handle_event (ClutterAction *action, return CLUTTER_EVENT_PROPAGATE; } - if (priv->in_gesture && point && + if (point && event_type == CLUTTER_LEAVE && (event->crossing.flags & CLUTTER_EVENT_FLAG_GRAB_NOTIFY) != 0) { - priv->in_gesture = FALSE; - cancel_gesture (gesture_action); + gesture_unregister_point (gesture_action, position); + + if (priv->in_gesture) + cancel_gesture (gesture_action); + return CLUTTER_EVENT_PROPAGATE; }