forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
ce5560a790
commit
4e24cb8588
@ -1033,7 +1033,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_CSS_PROPERTY_ICON_THEME,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
|
||||
GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON | GTK_CSS_AFFECTS_ICON_SIZE,
|
||||
icon_theme_value_parse,
|
||||
NULL,
|
||||
gtk_css_icon_theme_value_new (NULL));
|
||||
@ -1592,7 +1592,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_CSS_PROPERTY_ICON_STYLE,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
|
||||
GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON | GTK_CSS_AFFECTS_ICON_SIZE,
|
||||
icon_style_parse,
|
||||
NULL,
|
||||
_gtk_css_icon_style_value_new (GTK_CSS_ICON_STYLE_REQUESTED));
|
||||
|
@ -127,6 +127,7 @@ typedef enum {
|
||||
GTK_CSS_AFFECTS_CONTENT = (1 << 0),
|
||||
GTK_CSS_AFFECTS_BACKGROUND = (1 << 1),
|
||||
GTK_CSS_AFFECTS_BORDER = (1 << 2),
|
||||
GTK_CSS_AFFECTS_ICON_SIZE = (1 << 3),
|
||||
GTK_CSS_AFFECTS_TEXT_ATTRS = (1 << 4),
|
||||
GTK_CSS_AFFECTS_TEXT_SIZE = (1 << 5),
|
||||
GTK_CSS_AFFECTS_TEXT_CLIP = (1 << 6),
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user