[gtk+] GtkTimeline: don't look when animations are disabled



commit c43ada95aa5d398d9bf426a31a7af462b10126fd
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Apr 14 08:56:07 2011 -0400

    GtkTimeline: don't look when animations are disabled
    
    Otherwise, we end up doing maximal work with minimal effect, and
    bring the X server to 100% CPU. Note that this makes spinner widgets
    look really unclear, but they really have to be changed to adapt
    to enable-animations == FALSE at the widget level.

 gtk/gtktimeline.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtktimeline.c b/gtk/gtktimeline.c
index 18d3f95..db9b0be 100644
--- a/gtk/gtktimeline.c
+++ b/gtk/gtktimeline.c
@@ -340,7 +340,13 @@ gtk_timeline_run_frame (GtkTimeline *timeline)
   if ((priv->direction == GTK_TIMELINE_DIRECTION_FORWARD && progress == 1.0) ||
       (priv->direction == GTK_TIMELINE_DIRECTION_BACKWARD && progress == 0.0))
     {
-      if (!priv->loop)
+      gboolean loop;
+
+      loop = priv->loop && priv->animations_enabled;
+
+      if (loop)
+        _gtk_timeline_rewind (timeline);
+      else
         {
           if (priv->source_id)
             {
@@ -351,8 +357,6 @@ gtk_timeline_run_frame (GtkTimeline *timeline)
           g_signal_emit (timeline, signals [FINISHED], 0);
           return FALSE;
         }
-      else
-        _gtk_timeline_rewind (timeline);
     }
 
   return TRUE;
@@ -417,7 +421,7 @@ _gtk_timeline_start (GtkTimeline *timeline)
           g_object_get (settings, "gtk-enable-animations", &enable_animations, NULL);
         }
 
-      priv->animations_enabled = (enable_animations == TRUE);
+      priv->animations_enabled = enable_animations;
 
       g_signal_emit (timeline, signals [STARTED], 0);
 



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