diff --git a/clutter/clutter/clutter-click-action.c b/clutter/clutter/clutter-click-action.c index 7af3f2e18..4e6b53630 100644 --- a/clutter/clutter/clutter-click-action.c +++ b/clutter/clutter/clutter-click-action.c @@ -423,6 +423,19 @@ clutter_click_action_handle_event (ClutterAction *action, return priv->is_held ? CLUTTER_EVENT_STOP : CLUTTER_EVENT_PROPAGATE; } +static void +clutter_click_action_sequence_cancelled (ClutterAction *action, + ClutterInputDevice *device, + ClutterEventSequence *sequence) +{ + ClutterClickAction *self = CLUTTER_CLICK_ACTION (action); + ClutterClickActionPrivate *priv = + clutter_click_action_get_instance_private (self); + + if (priv->press_device == device && priv->press_sequence == sequence) + clutter_click_action_release (self); +} + static void clutter_click_action_set_actor (ClutterActorMeta *meta, ClutterActor *actor) @@ -530,6 +543,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) ClutterActionClass *action_class = CLUTTER_ACTION_CLASS (klass); action_class->handle_event = clutter_click_action_handle_event; + action_class->sequence_cancelled = clutter_click_action_sequence_cancelled; meta_class->set_actor = clutter_click_action_set_actor; meta_class->set_enabled = clutter_click_action_set_enabled; diff --git a/clutter/clutter/clutter-gesture-action.c b/clutter/clutter/clutter-gesture-action.c index a09084aa8..d48e68358 100644 --- a/clutter/clutter/clutter-gesture-action.c +++ b/clutter/clutter/clutter-gesture-action.c @@ -512,6 +512,38 @@ clutter_gesture_action_handle_event (ClutterAction *action, CLUTTER_EVENT_PROPAGATE; } +static void +clutter_gesture_action_sequence_cancelled (ClutterAction *action, + ClutterInputDevice *device, + ClutterEventSequence *sequence) +{ + ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (action); + ClutterGestureActionPrivate *priv = + clutter_gesture_action_get_instance_private (self); + int i, position = -1; + + for (i = 0; i < priv->points->len; i++) + { + if ((g_array_index (priv->points, GesturePoint, i).device == device) && + (g_array_index (priv->points, GesturePoint, i).sequence == sequence)) + { + position = i; + break; + } + } + + if (position == -1) + return; + + if (priv->in_gesture) + { + priv->in_gesture = FALSE; + cancel_gesture (self); + } + + gesture_unregister_point (self, position); +} + static void clutter_gesture_action_set_enabled (ClutterActorMeta *meta, gboolean is_enabled) @@ -642,6 +674,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass) meta_class->set_enabled = clutter_gesture_action_set_enabled; action_class->handle_event = clutter_gesture_action_handle_event; + action_class->sequence_cancelled = clutter_gesture_action_sequence_cancelled; klass->gesture_begin = default_event_handler; klass->gesture_progress = default_event_handler;