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.

https://bugzilla.gnome.org/show_bug.cgi?id=683948
This commit is contained in:
Emanuele Aina
2012-10-01 16:15:06 +02:00
parent bd1febb2ea
commit 61f2d751d0
9 changed files with 273 additions and 5 deletions

View File

@ -26,9 +26,9 @@ static int n_gravities = G_N_ELEMENTS (gravities);
static int cur_gravity = 0;
static void
on_clicked (ClutterClickAction *action,
ClutterActor *actor,
ClutterText *label)
on_tap (ClutterTapAction *action,
ClutterActor *actor,
ClutterText *label)
{
gchar *str;
@ -105,8 +105,8 @@ main (int argc, char *argv[])
g_free (str);
action = clutter_click_action_new ();
g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), text);
action = clutter_tap_action_new ();
g_signal_connect (action, "tap", G_CALLBACK (on_tap), text);
clutter_actor_set_reactive (box, TRUE);
clutter_actor_add_action (box, action);