From 3b298ddfa333eb4963c24f119b6578398b821ef0 Mon Sep 17 00:00:00 2001 From: Emanuele Aina Date: Wed, 5 Sep 2012 14:50:28 +0000 Subject: [PATCH] pan-action: emit ::pan-stopped before ::gesture-begin When starting a new gesture before the momentum of the previous one has finished the ::pan-stopped was counter-intuitively emitted after the new ::gesture-begin. Make use of gesture_prepare() to reset the state of the action right before emitting ::gesture-begin. https://bugzilla.gnome.org/show_bug.cgi?id=683431 --- clutter/clutter-pan-action.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-pan-action.c b/clutter/clutter-pan-action.c index 30e860eba..8aa728131 100644 --- a/clutter/clutter-pan-action.c +++ b/clutter/clutter-pan-action.c @@ -188,8 +188,8 @@ on_deceleration_new_frame (ClutterTimeline *timeline, } static gboolean -gesture_begin (ClutterGestureAction *gesture, - ClutterActor *actor) +gesture_prepare (ClutterGestureAction *gesture, + ClutterActor *actor) { ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture); ClutterPanActionPrivate *priv = self->priv; @@ -197,6 +197,16 @@ gesture_begin (ClutterGestureAction *gesture, if (priv->state == PAN_STATE_INTERPOLATING && priv->deceleration_timeline) clutter_timeline_stop (priv->deceleration_timeline); + return TRUE; +} + +static gboolean +gesture_begin (ClutterGestureAction *gesture, + ClutterActor *actor) +{ + ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture); + ClutterPanActionPrivate *priv = self->priv; + priv->state = PAN_STATE_PANNING; priv->interpolated_x = priv->interpolated_y = 0.0f; priv->dx = priv->dy = 0.0f; @@ -421,6 +431,7 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass) klass->pan = clutter_pan_action_real_pan; + gesture_class->gesture_prepare = gesture_prepare; gesture_class->gesture_begin = gesture_begin; gesture_class->gesture_progress = gesture_progress; gesture_class->gesture_cancel = gesture_cancel;