[clutter] Make sure the gesture is cancelled even if we miss the release event



commit 01cf70594dd29f7c80c73b0b89ca1d044777d04c
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Thu Jul 14 13:11:12 2011 +0200

    Make sure the gesture is cancelled even if we miss the release event

 clutter/clutter-gesture-action.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-gesture-action.c b/clutter/clutter-gesture-action.c
index 1575391..b423e9b 100644
--- a/clutter/clutter-gesture-action.c
+++ b/clutter/clutter-gesture-action.c
@@ -133,6 +133,18 @@ stage_captured_event_cb (ClutterActor       *stage,
     {
     case CLUTTER_MOTION:
       {
+        ClutterModifierType mods = clutter_event_get_state (event);
+
+        /* we might miss a button-release event in case of grabs,
+         * so we need to check whether the button is still down
+         * during a motion event
+         */
+        if (!(mods & CLUTTER_BUTTON1_MASK))
+          {
+            cancel_gesture (action);
+            return FALSE;
+          }
+
         clutter_event_get_coords (event, &priv->last_motion_x,
                                          &priv->last_motion_y);
 



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