]> Pileus Git - ~andy/gtk/commitdiff
GtkTimeline: don't look when animations are disabled
authorMatthias Clasen <mclasen@redhat.com>
Thu, 14 Apr 2011 12:56:07 +0000 (08:56 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 14 Apr 2011 12:58:48 +0000 (08:58 -0400)
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

index 18d3f950f51464b8200e542bcdd5a0818d49e0d4..db9b0beca2ecac803c811540f8744a8fd4f63ec2 100644 (file)
@@ -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);