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




commit 34e3ffaaf5224c8b06f8dd6027ae9d6c18f720e2
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.

 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]