[gnome-shell/gnome-3-32] st: Only emit ::style-changed on actual changes



commit f662864adab3ddfc0e6b730c5afd25cbefb99da7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Apr 19 13:43:39 2019 +0000

    st: Only emit ::style-changed on actual changes
    
    Compare painting/geometry of old and new paint nodes, so it's ensured to
    be only emitted on actual style changes. Emission still must be propagated
    through to children, though.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1153
    
    
    (cherry picked from commit f74c07b9acbdc6945ca37f86bc680701f048f174)

 src/st/st-widget.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index b20148906..d416374d5 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -1718,7 +1718,7 @@ st_widget_recompute_style (StWidget    *widget,
   StThemeNode *new_theme_node = st_widget_get_theme_node (widget);
   int transition_duration;
   StSettings *settings;
-  gboolean paint_equal;
+  gboolean paint_equal, geometry_equal = FALSE;
   gboolean animations_enabled;
 
   if (new_theme_node == old_theme_node)
@@ -1729,8 +1729,9 @@ st_widget_recompute_style (StWidget    *widget,
 
   _st_theme_node_apply_margins (new_theme_node, CLUTTER_ACTOR (widget));
 
-  if (!old_theme_node ||
-      !st_theme_node_geometry_equal (old_theme_node, new_theme_node))
+  if (old_theme_node)
+    geometry_equal = st_theme_node_geometry_equal (old_theme_node, new_theme_node);
+  if (!geometry_equal)
     clutter_actor_queue_relayout ((ClutterActor *) widget);
 
   transition_duration = st_theme_node_get_transition_duration (new_theme_node);
@@ -1782,7 +1783,11 @@ st_widget_recompute_style (StWidget    *widget,
         st_theme_node_paint_state_invalidate (current_paint_state (widget));
     }
 
-  g_signal_emit (widget, signals[STYLE_CHANGED], 0);
+  if (!paint_equal || !geometry_equal)
+    g_signal_emit (widget, signals[STYLE_CHANGED], 0);
+  else
+    notify_children_of_style_change ((ClutterActor *) widget);
+
   priv->is_style_dirty = FALSE;
 }
 


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