GNOME Bugzilla – Bug 683948
Add TapAction as subclass of GestureAction to deprecate ClickAction
Last modified: 2012-10-19 12:04:12 UTC
ClickAction just got support for touch events, but it's support is not as sophisticated as the one from GestureAction (no multi touch support). ClickAction also lacks many accessors already provided by GestureAction (event sequence, event device, release coords, etc.) A TapAction subclassing of GestureAction should replace ClickAction. Note that it would mean that GestureAction needs a way for subclassess to define a custom drag_threshold, as in this case it's meaning would be reversed: the action should start immediately and be *cancelled* if the threshold has been trespassed.
Created attachment 225498 [details] [review] tap-action: Add TapAction, to handle mouse/touch tapping TapAction is a GestureAction-subclass that handles clicks and tap gestures. It is meant to provide a replacement for ClickAction using GestureAction: • building upon GestureAction the amount of code is greatly reduced; • it does not capture events. TapAction provides: • tap signal, notifying users when a tap has been performed; • threshold property, overriding the GestureAction::threshold property and using it as the maximum distance tolerated before cancelling the gesture. The image-content example program has been updated replacing its ClickAction usage with TapAction.
Created attachment 225870 [details] [review] tap-action: Add TapAction, to handle mouse/touch tapping Removed a debugging g_printf()
Created attachment 226527 [details] [review] tap-action: Add TapAction, to handle mouse/touch tapping TapAction is a GestureAction-subclass that handles clicks and tap gestures. It is meant to provide a replacement for ClickAction using GestureAction: • it handles events trasparently without capturing them, so that it can coexists with other GestureActions; • the ::tap signal is not emitted if the drag threshold is exceeded; • building upon GestureAction the amount of code is greatly reduced. TapAction provides: • tap signal, notifying users when a tap has been performed. The image-content example program has been updated replacing its ClickAction usage with TapAction.
Review of attachment 226527 [details] [review]: looks good, with a couple of fixes. you need to add the new functions to the clutter.symbols file, and you also need to update the API reference. ::: clutter/clutter-tap-action.c @@ +47,3 @@ + * clutter_actor_add_action (actor, clutter_tap_action_new ()); + * clutter_actor_set_reactive (actor, TRUE); + * g_signal_connect (actor, "tap", on_tap_callback); you probably want to fix this example to make the code valid ;-) @@ +88,3 @@ + ClutterActor *actor) +{ + emit_tap ((ClutterTapAction *)gesture, actor); please, use the safe cast macro.
Add a dependency on #685221 because otherwise it is not possible to get ::tap events after a gesture has been cancelled (`priv->points->len' will grow indefinitely above `priv->requested_nb_points' blocking the emission of the ::gesture-end signal).
Created attachment 226813 [details] [review] tap-action: Add TapAction, to handle mouse/touch tapping Fix docs and list functions in clutter.symbols.
The following fix has been pushed: 61f2d75 tap-action: Add TapAction, to handle mouse/touch tapping
Created attachment 226816 [details] [review] tap-action: Add TapAction, to handle mouse/touch tapping TapAction is a GestureAction-subclass that handles clicks and tap gestures. It is meant to provide a replacement for ClickAction using GestureAction: • it handles events trasparently without capturing them, so that it can coexists with other GestureActions; • the ::tap signal is not emitted if the drag threshold is exceeded; • building upon GestureAction the amount of code is greatly reduced. TapAction provides: • tap signal, notifying users when a tap has been performed. The image-content example program has been updated replacing its ClickAction usage with TapAction.