summaryrefslogtreecommitdiff
path: root/gtk/gtkiconhelper.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-10-14 14:58:53 +0200
committerTimm Bäder <mail@baedert.org>2017-10-14 17:27:55 +0200
commit4e24cb858866abafc7208b33df9099d8b5e85d66 (patch)
treebf5894ddca06677b951dd2c55d3c9c670f636a83 /gtk/gtkiconhelper.c
parentce5560a790fe4c20a1c8abe52fd223491129d01a (diff)
downloadgtk+-4e24cb858866abafc7208b33df9099d8b5e85d66.tar.gz
css: Add GTK_CSS_AFFECTS_ICON_SIZE
And use it in GtkIconHelper. This way, we can avoid resizes when e.g. the fg color of a symbolic icon changes.
Diffstat (limited to 'gtk/gtkiconhelper.c')
-rw-r--r--gtk/gtkiconhelper.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 5fe768995b..484c022ace 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -60,7 +60,20 @@ gtk_icon_helper_invalidate_for_change (GtkIconHelper *self,
(gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON) &&
!self->rendered_surface_is_symbolic)))
{
- gtk_icon_helper_invalidate (self);
+ /* Avoid the queue_resize in gtk_icon_helper_invalidate */
+ g_clear_object (&self->texture);
+
+ if (self->rendered_surface != NULL)
+ {
+ cairo_surface_destroy (self->rendered_surface);
+ self->rendered_surface = NULL;
+ self->rendered_surface_is_symbolic = FALSE;
+ }
+
+ if (change == NULL ||
+ (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON_SIZE) &&
+ !GTK_IS_CSS_TRANSIENT_NODE (self->node)))
+ gtk_widget_queue_resize (self->owner);
}
}