GNOME Bugzilla – Bug 685221
Points get stuck in th tracking array when returning FALSE from ::gesture-progress
Last modified: 2012-10-19 12:03:42 UTC
When a ::gesture-progress callback requests that the gesture should be cancelled by returning FALSE, GestureAction doesn't unregister the point but removes the stage_capture handler, causing the point to never leave the array. Subsequent gesture will have the wrong number of registered touchpoints and gesture_find_point() may return the original point for devices that lack a sequence identifier (eg. mouse). The simplest solution is to empty the array tracking touch points in cancel_gesture(), which will make the gesture need a whole new set of touch points before being restarted. Another solution may consist in calling gesture_unregister_point() for the event that causes the gesture to be cancelled: this will make eg. a three finger gesture restart by just releasing/pressing the finger that has caused the cancellation (provided that the other two finger are still pressed).
Created attachment 225502 [details] [review] gesture-action: unregister all tracked points on cancel Ensure that when cancelling a gesture, either because a callback has returned FALSE or because clutter_gesture_action_cancel() has been called, the array tracking touch points is emptied and a whole new set of touch points is needed before restarting the gesture.
(In reply to comment #0) > Another solution may consist in calling gesture_unregister_point() for the > event that causes the gesture to be cancelled: this will make eg. a three > finger gesture restart by just releasing/pressing the finger that has caused > the cancellation (provided that the other two finger are still pressed). I don't think this is desirable: a gesture requiring N touch points should be cancelled when the effective number of touch points is less than N (and, arguably, more than N as well, though I'd have to check the semantics on other platforms for that). cancelling the gesture should reset its state, to allow other gestures to "pick up" the remaining touch points, e.g. you could have a three fingers action and a two fingers action, with the two fingers action acting as a fall back.
Yes, the "reset the whole state" is far simpler to understand (and implement), that's why the patch I sent does exactly that. Let me know if I should cook a patch to cancel actions when the active touchpoint grows above the requested number because it was in my TODO... :)
Review of attachment 225502 [details] [review]: looks good.
The following fix has been pushed: bd1febb gesture-action: Unregister all tracked points on cancel
Created attachment 226815 [details] [review] gesture-action: Unregister all tracked points on cancel Ensure that when cancelling a gesture, either because a callback has returned FALSE or because clutter_gesture_action_cancel() has been called, the array tracking touch points is emptied and a whole new set of touch points is needed before restarting the gesture.