After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749739 - prepare ClutterSwipeAction for multi-finger swipes
prepare ClutterSwipeAction for multi-finger swipes
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: ClutterAction
1.20.x
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-05-22 16:52 UTC by Carlos Garnacho
Modified: 2015-05-26 17:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
swipe-action: Prepare for multifinger swipes (1.72 KB, patch)
2015-05-22 16:52 UTC, Carlos Garnacho
reviewed Details | Review
swipe-action: Prepare for multifinger swipes (1.86 KB, patch)
2015-05-26 16:34 UTC, Carlos Garnacho
accepted-commit_now Details | Review

Description Carlos Garnacho 2015-05-22 16:52:12 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.
Comment 1 Carlos Garnacho 2015-05-22 16:52:45 UTC
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.
Comment 2 Emmanuele Bassi (:ebassi) 2015-05-26 16:13:34 UTC
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().
Comment 3 Carlos Garnacho 2015-05-26 16:29:41 UTC
(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.
Comment 4 Carlos Garnacho 2015-05-26 16:34:07 UTC
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.
Comment 5 Emmanuele Bassi (:ebassi) 2015-05-26 16:45:24 UTC
Review of attachment 304030 [details] [review]:

Looks good.
Comment 6 Carlos Garnacho 2015-05-26 17:05:00 UTC
Attachment 304030 [details] pushed as a4962c0 - swipe-action: Prepare for multifinger swipes