[gnome-shell] st: Consider non-background properties for ::style-changed



commit be40de5a9b684fe3f0d98a329bb35523ceb85dc6
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed May 1 12:34:00 2019 +0200

    st: Consider non-background properties for ::style-changed
    
    st_theme_node_paint_equal() was originally added to preserve paint state
    when a style change didn't affect any of StWidget's cached background
    resources.
    That's why using it for filtering out unneeded style changes as in commit
    f662864a misses any non-background related properties that are relevant
    for subclasses. Add additional tests to make sure we keep emitting the
    signal in those cases.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/1212

 src/st/st-widget.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index a3feb1503..2b770b52e 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -42,6 +42,7 @@
 #include "st-theme-context.h"
 #include "st-theme-node-transition.h"
 #include "st-theme-node-private.h"
+#include "st-drawing-area.h"
 
 #include "st-widget-accessible.h"
 
@@ -1826,6 +1827,27 @@ st_widget_recompute_style (StWidget    *widget,
         st_theme_node_paint_state_invalidate (current_paint_state (widget));
     }
 
+  /* It is very likely that custom CSS properties are used with StDrawingArea
+     to control the custom drawing, so never omit the ::style-changed signal */
+  if (paint_equal)
+    paint_equal = !ST_IS_DRAWING_AREA (widget);
+
+  if (paint_equal && old_theme_node->font_desc != NULL)
+    paint_equal = pango_font_description_equal (old_theme_node->font_desc,
+                                                st_theme_node_get_font (new_theme_node));
+
+  if (paint_equal && old_theme_node->foreground_computed)
+    {
+      ClutterColor col;
+
+      st_theme_node_get_foreground_color (new_theme_node, &col);
+      paint_equal = clutter_color_equal (&old_theme_node->foreground_color, &col);
+    }
+
+  if (paint_equal && old_theme_node->icon_colors)
+    paint_equal = st_icon_colors_equal (old_theme_node->icon_colors,
+                                        st_theme_node_get_icon_colors (new_theme_node));
+
   if (!paint_equal || !geometry_equal)
     g_signal_emit (widget, signals[STYLE_CHANGED], 0);
   else


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