Add default closures for the signals in ClutterGestureAction

Also make sure we cancel the gesture as soon as we know we have to
This commit is contained in:
Tomeu Vizoso 2011-07-13 18:31:22 +02:00
parent 48426c28bf
commit c8e3db105c

View File

@ -159,7 +159,10 @@ stage_captured_event_cb (ClutterActor *stage,
g_signal_emit (action, gesture_signals[GESTURE_BEGIN], 0, actor, g_signal_emit (action, gesture_signals[GESTURE_BEGIN], 0, actor,
&return_value); &return_value);
if (!return_value) if (!return_value)
cancel_gesture (action); {
cancel_gesture (action);
return FALSE;
}
} }
else else
return FALSE; return FALSE;
@ -168,7 +171,10 @@ stage_captured_event_cb (ClutterActor *stage,
g_signal_emit (action, gesture_signals[GESTURE_PROGRESS], 0, actor, g_signal_emit (action, gesture_signals[GESTURE_PROGRESS], 0, actor,
&return_value); &return_value);
if (!return_value) if (!return_value)
cancel_gesture (action); {
cancel_gesture (action);
return FALSE;
}
} }
break; break;
@ -254,6 +260,13 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
meta_class->set_actor (meta, actor); meta_class->set_actor (meta, actor);
} }
static gboolean
default_event_handler (ClutterGestureAction *action,
ClutterActor *actor)
{
return TRUE;
}
static void static void
clutter_gesture_action_class_init (ClutterGestureActionClass *klass) clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
{ {
@ -263,6 +276,10 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
meta_class->set_actor = clutter_gesture_action_set_actor; meta_class->set_actor = clutter_gesture_action_set_actor;
klass->gesture_begin = default_event_handler;
klass->gesture_progress = default_event_handler;
klass->gesture_end = default_event_handler;
/** /**
* ClutterGestureAction::gesture-begin: * ClutterGestureAction::gesture-begin:
* @action: the #ClutterGestureAction that emitted the signal * @action: the #ClutterGestureAction that emitted the signal