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
This commit is contained in:
Florian Müllner 2019-05-01 12:34:00 +02:00 committed by Georges Basile Stavracas Neto
parent 7359e431d3
commit be40de5a9b

View File

@ -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