[mutter/wip/carlosg/gesture-leave-handling] clutter: Always unregister point on GRAB_NOTIFY leave event




commit 5d293d1a4cb03197dc80061df7c84c3c71fcaf81
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 9 23:00:40 2022 +0100

    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

 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 a57faa74be..bcca5a08d6 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;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]