[gnome-shell/wip/carlosg/invalidate-styles] st: Ensure to reset all widget theme nodes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/invalidate-styles] st: Ensure to reset all widget theme nodes
- Date: Tue, 28 Apr 2020 11:40:17 +0000 (UTC)
commit e5e5389a537a9d238d8188515de95dcc5a1fdd8f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Apr 25 18:31:11 2020 +0200
st: Ensure to reset all widget theme nodes
Theme node invalidation stops at unmapped widgets, and widgets
that forget to chain up to the default ::style-changed implementation.
This may leave stale nodes that were invalidated on
StThemeContext::changed, but are still set on widgets, and maybe
used for CSS property lookups.
Make it sure that theme node invalidation happens always by moving
propagation outside the vfunc, and ensure the theme nodes are reset
across the full actor tree. Emission of ::style-changed, and obtaining
a new theme node may be delayed till when the actor is mapped.
The theme node is also cleared after unparenting an actor to avoid
stale references.
This ensures that all widgets get their theme node cleared after
stylesheet changes, instead of maybe being left with a theme node
that's been cleared of all its properties.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1223
src/st/st-widget.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 7314a6ca5f..c290228bf6 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -463,9 +463,7 @@ st_widget_parent_set (ClutterActor *widget,
new_parent = clutter_actor_get_parent (widget);
- /* don't send the style changed signal if we no longer have a parent actor */
- if (new_parent)
- st_widget_style_changed (self);
+ st_widget_style_changed (self);
}
static void
@@ -510,7 +508,6 @@ static void
st_widget_real_style_changed (StWidget *self)
{
clutter_actor_queue_redraw ((ClutterActor *) self);
- notify_children_of_style_change ((ClutterActor *) self);
}
void
@@ -530,6 +527,8 @@ st_widget_style_changed (StWidget *widget)
if (clutter_actor_is_mapped (CLUTTER_ACTOR (widget)))
st_widget_recompute_style (widget, old_theme_node);
+ notify_children_of_style_change (CLUTTER_ACTOR (widget));
+
if (old_theme_node)
g_object_unref (old_theme_node);
}
@@ -1772,8 +1771,6 @@ st_widget_recompute_style (StWidget *widget,
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;
}
@@ -1795,7 +1792,10 @@ st_widget_ensure_style (StWidget *widget)
priv = st_widget_get_instance_private (widget);
if (priv->is_style_dirty)
- st_widget_recompute_style (widget, NULL);
+ {
+ st_widget_recompute_style (widget, NULL);
+ notify_children_of_style_change (CLUTTER_ACTOR (widget));
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]