[mutter] clutter/click-action: Only emit "clicked" when within drag threshold



commit 6239e6db182d066f0ebdd18a3624b67dd40a405e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Jan 11 14:29:08 2021 -0300

    clutter/click-action: Only emit "clicked" when within drag threshold
    
    ClutterClickEvent currently doesn't check if button press and release
    happen within the drag threshold, which can be surprising sometimes.
    
    Only emit the "clicked" signal if the button press and release happen
    within the area of drag threshold.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1667>

 clutter/clutter/clutter-click-action.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-click-action.c b/clutter/clutter/clutter-click-action.c
index 63ad203d12..bd94d91051 100644
--- a/clutter/clutter/clutter-click-action.c
+++ b/clutter/clutter/clutter-click-action.c
@@ -419,7 +419,9 @@ on_captured_event (ClutterActor       *stage,
         priv->modifier_state = 0;
 
       click_action_set_pressed (action, FALSE);
-      g_signal_emit (action, click_signals[CLICKED], 0, actor);
+
+      if (event_within_drag_threshold (action, event))
+        g_signal_emit (action, click_signals[CLICKED], 0, actor);
       break;
 
     case CLUTTER_MOTION:


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