[gnome-shell] st/icon: Ensure icons are updated if theme node is invalid



commit 2bcc6c09edcdfa9929e8c3b4c3ce7ec652b0ad46
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Sep 22 23:37:16 2021 +0200

    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 0b1dfbf6f3f, 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>

 src/st/st-icon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index 71ba1b6b36..876aa9bbbf 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -59,6 +59,7 @@ struct _StIconPrivate
   gint             theme_icon_size; /* icon size from theme node */
   gint             icon_size;       /* icon size we are using */
   GIcon           *fallback_gicon;
+  gboolean         needs_update;
 
   StIconColors     *colors;
 
@@ -253,7 +254,7 @@ st_icon_style_changed (StWidget *widget)
 
   should_update |= st_icon_update_icon_size (self);
 
-  if (should_update)
+  if (priv->needs_update || should_update)
     st_icon_update (self);
 
   ST_WIDGET_CLASS (st_icon_parent_class)->style_changed (widget);
@@ -487,6 +488,8 @@ st_icon_update (StIcon *icon)
       return;
     }
 
+  priv->needs_update = TRUE;
+
   theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
   if (theme_node == NULL)
     return;
@@ -525,6 +528,7 @@ st_icon_update (StIcon *icon)
                                                          priv->icon_size / paint_scale,
                                                          paint_scale,
                                                          resource_scale);
+  priv->needs_update = FALSE;
 
   if (priv->pending_texture)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]