[gtk+] animations: Don't set animated values for finished transitions



commit 55ade04e115e81851aa4cc9ee038509e60cb7bbc
Author: Benjamin Otte <otte redhat com>
Date:   Fri Oct 5 18:45:37 2012 +0200

    animations: Don't set animated values for finished transitions
    
    Otherwise, that value will never get reset and remain frozen in time.
    This is problematic for example when the value is inherited and the
    parent changes the value.

 gtk/gtkcsstransition.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcsstransition.c b/gtk/gtkcsstransition.c
index bbd2dcc..08db428 100644
--- a/gtk/gtkcsstransition.c
+++ b/gtk/gtkcsstransition.c
@@ -38,9 +38,7 @@ gtk_css_transition_set_values (GtkStyleAnimation    *animation,
 
   if (transition->start_time >= for_time_us)
     value = _gtk_css_value_ref (transition->start);
-  else if (transition->end_time <= for_time_us)
-    value = _gtk_css_value_ref (end);
-  else
+  else if (transition->end_time > for_time_us)
     {
       progress = (double) (for_time_us - transition->start_time) / (transition->end_time - transition->start_time);
       progress = _gtk_css_ease_value_transform (transition->ease, progress);
@@ -52,9 +50,14 @@ gtk_css_transition_set_values (GtkStyleAnimation    *animation,
       if (value == NULL)
         value = _gtk_css_value_ref (end);
     }
+  else
+    value = NULL;
 
-  _gtk_css_computed_values_set_animated_value (values, transition->property, value);
-  _gtk_css_value_unref (value);
+  if (value)
+    {
+      _gtk_css_computed_values_set_animated_value (values, transition->property, value);
+      _gtk_css_value_unref (value);
+    }
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]