[mutter/wip/carlosg/app-grid-gestures: 15/15] clutter: Ensure to reset touchpoints when disabling action




commit 83ed2afe34ce88347cc226912fe8c8515ba20e3a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Mar 18 18:38:18 2021 +0100

    clutter: Ensure to reset touchpoints when disabling action
    
    The action might not have been triggered yet, as per its trigger
    threshold. This doesn't mean we shouldn't reset the point(s) accumulated
    so far.
    
    This fixes those touchpoints persisting after disable/enable, thus
    making gesture recognition fail from there on.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1791>

 clutter/clutter/clutter-gesture-action.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/clutter-gesture-action.c b/clutter/clutter/clutter-gesture-action.c
index ab69bcf37f..f938a549aa 100644
--- a/clutter/clutter/clutter-gesture-action.c
+++ b/clutter/clutter/clutter-gesture-action.c
@@ -572,8 +572,13 @@ clutter_gesture_action_set_enabled (ClutterActorMeta *meta,
   ClutterGestureActionPrivate *priv =
     clutter_gesture_action_get_instance_private (gesture_action);
 
-  if (!is_enabled && priv->in_gesture)
-    cancel_gesture (gesture_action);
+  if (!is_enabled)
+    {
+      if (priv->in_gesture)
+        cancel_gesture (gesture_action);
+      else
+        g_array_set_size (priv->points, 0);
+    }
 
   meta_class->set_enabled (meta, is_enabled);
 }


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