From 4fc6a804f58ac0a31633a6ad2394e673fcbfa1cc Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Thu, 15 Nov 2012 15:09:51 +0000
Subject: [PATCH] st_widget_recompute_style: short-circuit if the theme node is
 the same

It appears to be somewhat common for st_widget_style_changed() to be
called when no style-relevant attributes have, in fact, changed. Now that
we cache theme nodes, we're likely to get the same theme node back from
the cache. If we do, we don't need to waste time asking whether its
geometry and painting are equal to itself: we can just note that nothing
really changed and get on with our lives.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687465
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
---
 src/st/st-widget.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 2a9b8da26..b1218d3fb 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -1532,6 +1532,12 @@ st_widget_recompute_style (StWidget    *widget,
   int transition_duration;
   gboolean paint_equal;
 
+  if (new_theme_node == old_theme_node)
+    {
+      widget->priv->is_style_dirty = FALSE;
+      return;
+    }
+
   if (!old_theme_node ||
       !st_theme_node_geometry_equal (old_theme_node, new_theme_node))
     clutter_actor_queue_relayout ((ClutterActor *) widget);