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 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. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2541 https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1223
This commit is contained in:
parent
1fa4e3b1b2
commit
325ff73c5b
@ -455,16 +455,11 @@ st_widget_parent_set (ClutterActor *widget,
|
|||||||
{
|
{
|
||||||
StWidget *self = ST_WIDGET (widget);
|
StWidget *self = ST_WIDGET (widget);
|
||||||
ClutterActorClass *parent_class;
|
ClutterActorClass *parent_class;
|
||||||
ClutterActor *new_parent;
|
|
||||||
|
|
||||||
parent_class = CLUTTER_ACTOR_CLASS (st_widget_parent_class);
|
parent_class = CLUTTER_ACTOR_CLASS (st_widget_parent_class);
|
||||||
if (parent_class->parent_set)
|
if (parent_class->parent_set)
|
||||||
parent_class->parent_set (widget, old_parent);
|
parent_class->parent_set (widget, old_parent);
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +505,6 @@ static void
|
|||||||
st_widget_real_style_changed (StWidget *self)
|
st_widget_real_style_changed (StWidget *self)
|
||||||
{
|
{
|
||||||
clutter_actor_queue_redraw ((ClutterActor *) self);
|
clutter_actor_queue_redraw ((ClutterActor *) self);
|
||||||
notify_children_of_style_change ((ClutterActor *) self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -530,6 +524,11 @@ st_widget_style_changed (StWidget *widget)
|
|||||||
if (clutter_actor_is_mapped (CLUTTER_ACTOR (widget)))
|
if (clutter_actor_is_mapped (CLUTTER_ACTOR (widget)))
|
||||||
st_widget_recompute_style (widget, old_theme_node);
|
st_widget_recompute_style (widget, old_theme_node);
|
||||||
|
|
||||||
|
/* Descend through all children. If the actor is not mapped,
|
||||||
|
* children will clear their theme node without recomputing style.
|
||||||
|
*/
|
||||||
|
notify_children_of_style_change (CLUTTER_ACTOR (widget));
|
||||||
|
|
||||||
if (old_theme_node)
|
if (old_theme_node)
|
||||||
g_object_unref (old_theme_node);
|
g_object_unref (old_theme_node);
|
||||||
}
|
}
|
||||||
@ -1772,8 +1771,6 @@ st_widget_recompute_style (StWidget *widget,
|
|||||||
|
|
||||||
if (!paint_equal || !geometry_equal)
|
if (!paint_equal || !geometry_equal)
|
||||||
g_signal_emit (widget, signals[STYLE_CHANGED], 0);
|
g_signal_emit (widget, signals[STYLE_CHANGED], 0);
|
||||||
else
|
|
||||||
notify_children_of_style_change ((ClutterActor *) widget);
|
|
||||||
|
|
||||||
priv->is_style_dirty = FALSE;
|
priv->is_style_dirty = FALSE;
|
||||||
}
|
}
|
||||||
@ -1795,7 +1792,10 @@ st_widget_ensure_style (StWidget *widget)
|
|||||||
priv = st_widget_get_instance_private (widget);
|
priv = st_widget_get_instance_private (widget);
|
||||||
|
|
||||||
if (priv->is_style_dirty)
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user