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
This commit is contained in:
Carlos Garnacho 2019-04-19 15:43:39 +02:00
parent 59edea4bb4
commit f74c07b9ac

View File

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