GNOME Bugzilla – Bug 749739
prepare ClutterSwipeAction for multi-finger swipes
Last modified: 2015-05-26 17:05:00 UTC
ClutterSwipeAction is currently checking the press/release coordinates of the first touchpoint on ::gesture-end. This is obviously right on the default n-touch-points=1 for this action, although if you try to make it a multi-finger swipe through clutter_gesture_action_set_n_touch_points(), the release coordinates may wrongly come out as 0/0 if it wasn't the first touchpoint which triggered ::gesture-end. Unfortunately clutter_gesture_action_get_release_coords() don't have means to check whether the returned value is valid, so I'm attaching a patch that just peeks the coordinates from the last event received for the first touchpoint, this will be valid regardless of it being the finished one or not.
Created attachment 303833 [details] [review] 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.
Review of attachment 303833 [details] [review]: Could we change get_release_coords() to return valid coordinates if n_touch_points > 1? ::: clutter/clutter-swipe-action.c @@ +152,3 @@ &press_x, &press_y); + last_event = clutter_gesture_action_get_last_event (action, 0); Sounds good. Would be nice to leave a comment here, so that we don't have to resort to `git blame` to figure out why we go through the event instead of using get_release_coords().
(In reply to Emmanuele Bassi (:ebassi) from comment #2) > Review of attachment 303833 [details] [review] [review]: > > Could we change get_release_coords() to return valid coordinates if > n_touch_points > 1? I guess we can return the last motion event coordinates if this touch didn't finish yet, It's unlikely that we call this outside of ::gesture-end, I start to wonder whether the function name is right for what it'd do though... > > ::: clutter/clutter-swipe-action.c > @@ +152,3 @@ > &press_x, &press_y); > > + last_event = clutter_gesture_action_get_last_event (action, 0); > > Sounds good. > > Would be nice to leave a comment here, so that we don't have to resort to > `git blame` to figure out why we go through the event instead of using > get_release_coords(). I'm at the moment going this way, let me update the patch.
Created attachment 304030 [details] [review] 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.
Review of attachment 304030 [details] [review]: Looks good.
Attachment 304030 [details] pushed as a4962c0 - swipe-action: Prepare for multifinger swipes