From c43ada95aa5d398d9bf426a31a7af462b10126fd Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Apr 2011 08:56:07 -0400 Subject: [PATCH] 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 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gtk/gtktimeline.c b/gtk/gtktimeline.c index 18d3f950f5..db9b0beca2 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);