st/icon: Ensure icons are updated if theme node is invalid
Icons that are changed while an actor is not mapped may not have a theme
node associated with, and thus we'd end up not updating them at all.
In fact we return early in st_update_icon(), and this was not an issue
until commit 0b1dfbf6f3
, because we'd end up to update the icon anyways
once the style was changed (and so with a valid theme node), but since
such change we might not updating the icon if no theme detail changed.
To prevent this, add a flag to require an icon update when the theme
changed, if no successfully update happened earlier.
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4568
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1983>
This commit is contained in:
parent
3685cb15c6
commit
2bcc6c09ed
@ -59,6 +59,7 @@ struct _StIconPrivate
|
|||||||
gint theme_icon_size; /* icon size from theme node */
|
gint theme_icon_size; /* icon size from theme node */
|
||||||
gint icon_size; /* icon size we are using */
|
gint icon_size; /* icon size we are using */
|
||||||
GIcon *fallback_gicon;
|
GIcon *fallback_gicon;
|
||||||
|
gboolean needs_update;
|
||||||
|
|
||||||
StIconColors *colors;
|
StIconColors *colors;
|
||||||
|
|
||||||
@ -253,7 +254,7 @@ st_icon_style_changed (StWidget *widget)
|
|||||||
|
|
||||||
should_update |= st_icon_update_icon_size (self);
|
should_update |= st_icon_update_icon_size (self);
|
||||||
|
|
||||||
if (should_update)
|
if (priv->needs_update || should_update)
|
||||||
st_icon_update (self);
|
st_icon_update (self);
|
||||||
|
|
||||||
ST_WIDGET_CLASS (st_icon_parent_class)->style_changed (widget);
|
ST_WIDGET_CLASS (st_icon_parent_class)->style_changed (widget);
|
||||||
@ -487,6 +488,8 @@ st_icon_update (StIcon *icon)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->needs_update = TRUE;
|
||||||
|
|
||||||
theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
|
theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
|
||||||
if (theme_node == NULL)
|
if (theme_node == NULL)
|
||||||
return;
|
return;
|
||||||
@ -525,6 +528,7 @@ st_icon_update (StIcon *icon)
|
|||||||
priv->icon_size / paint_scale,
|
priv->icon_size / paint_scale,
|
||||||
paint_scale,
|
paint_scale,
|
||||||
resource_scale);
|
resource_scale);
|
||||||
|
priv->needs_update = FALSE;
|
||||||
|
|
||||||
if (priv->pending_texture)
|
if (priv->pending_texture)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user