[clutter] swipe-action: Prepare for multifinger swipes



commit a4962c033674ce358e6ae2adc16c97a00cca9971
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri May 22 13:19:29 2015 +0200

    swipe-action: Prepare for multifinger swipes
    
    Its ::gesture-end implementation used to check the press/release
    coordinates for the first touchpoint. On multifinger swipes, we
    can receive this vfunc called due to other touch sequence going
    first, so we'd get 0/0 as the release coordinates for this still
    active sequence, resulting in bogus directions.
    
    Instead, check the last event coordinates, that will be always
    correct regardless of whether the touchpoint 0 finished yet or
    not.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749739

 clutter/clutter-swipe-action.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter-swipe-action.c b/clutter/clutter-swipe-action.c
index 452a5a0..38e1830 100644
--- a/clutter/clutter-swipe-action.c
+++ b/clutter/clutter-swipe-action.c
@@ -145,14 +145,17 @@ gesture_end (ClutterGestureAction *action,
   gfloat release_x, release_y;
   ClutterSwipeDirection direction = 0;
   gboolean can_emit_swipe;
+  const ClutterEvent *last_event;
 
   clutter_gesture_action_get_press_coords (action,
                                            0,
                                            &press_x, &press_y);
 
-  clutter_gesture_action_get_release_coords (action,
-                                             0,
-                                             &release_x, &release_y);
+  /* Check the last event instead of get_release_coords(), this
+   * might not be the sequence that finished on multi-finger swipes.
+   */
+  last_event = clutter_gesture_action_get_last_event (action, 0);
+  clutter_event_get_coords (last_event, &release_x, &release_y);
 
   if (release_x - press_x > priv->distance_y)
     direction |= CLUTTER_SWIPE_DIRECTION_RIGHT;


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