From 24d43cd0766bdf1bb09c2e472187b6e5b03f585c Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 28 Mar 2012 12:43:57 +0100 Subject: [PATCH] actor: Check easing duration when updating in-flight transitions If we update a transition that is currently playing, we need to check the current easing state, and look at the eventual duration, in case the user wants to cancel the transition. --- clutter/clutter-actor.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index ca0ece9b9..865110945 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -17003,6 +17003,7 @@ _clutter_actor_update_transition (ClutterActor *actor, ...) { TransitionClosure *clos; + ClutterTimeline *timeline; ClutterInterval *interval; const ClutterAnimationInfo *info; va_list var_args; @@ -17020,6 +17021,8 @@ _clutter_actor_update_transition (ClutterActor *actor, if (clos == NULL) return; + timeline = CLUTTER_TIMELINE (clos->transition); + va_start (var_args, pspec); ptype = G_PARAM_SPEC_VALUE_TYPE (pspec); @@ -17041,7 +17044,17 @@ _clutter_actor_update_transition (ClutterActor *actor, clutter_interval_set_initial_value (interval, &initial); clutter_interval_set_final_value (interval, &final); - clutter_timeline_rewind (CLUTTER_TIMELINE (clos->transition)); + /* if we're updating with an easing duration of zero milliseconds, + * we just jump the timeline to the end and let it run its course + */ + if (info->cur_state == NULL || info->cur_state->easing_duration == 0) + { + guint duration = clutter_timeline_get_duration (timeline); + + clutter_timeline_advance (timeline, duration); + } + else + clutter_timeline_rewind (timeline); out: g_value_unset (&initial);