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
This commit is contained in:
Carlos Garnacho 2015-05-22 13:19:29 +02:00
parent 67bf902022
commit a4962c0336

View File

@ -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;