[gtk+/wip/baedert/symbolic-icons: 22/24] Add and use gtk_icon_helper_invalidate_for_change
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/symbolic-icons: 22/24] Add and use gtk_icon_helper_invalidate_for_change
- Date: Sun, 7 Feb 2016 07:55:38 +0000 (UTC)
commit 6e679f82f898aaee0ecf5671c480836e55b86c2c
Author: Timm Bäder <mail baedert org>
Date: Sat Feb 6 09:24:36 2016 +0100
Add and use gtk_icon_helper_invalidate_for_change
gtk/gtkiconhelper.c | 19 +++++++++++++++++--
gtk/gtkiconhelperprivate.h | 3 +++
gtk/gtkimage.c | 3 +--
3 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 0b4b9b7..ef05f83 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -63,6 +63,22 @@ gtk_icon_helper_invalidate (GtkIconHelper *self)
gtk_widget_queue_resize (gtk_css_gadget_get_owner (GTK_CSS_GADGET (self)));
}
+void
+gtk_icon_helper_invalidate_for_change (GtkIconHelper *self,
+ GtkCssStyleChange *change)
+{
+ GtkIconHelperPrivate *priv = self->priv;
+
+ if (change &&
+ ((gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SYMBOLIC_ICON) &&
+ priv->rendered_surface_is_symbolic) ||
+ (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON) &&
+ !priv->rendered_surface_is_symbolic)))
+ {
+ gtk_icon_helper_invalidate (self);
+ }
+}
+
static void
gtk_icon_helper_take_definition (GtkIconHelper *self,
GtkImageDefinition *def)
@@ -147,8 +163,7 @@ static void
gtk_icon_helper_style_changed (GtkCssGadget *gadget,
GtkCssStyleChange *change)
{
- if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON))
- gtk_icon_helper_invalidate (GTK_ICON_HELPER (gadget));
+ gtk_icon_helper_invalidate_for_change (GTK_ICON_HELPER (gadget), change);
if (!GTK_IS_CSS_TRANSIENT_NODE (gtk_css_gadget_get_node (gadget)))
GTK_CSS_GADGET_CLASS (gtk_icon_helper_parent_class)->style_changed (gadget, change);
diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h
index f4bdcd4..185c271 100644
--- a/gtk/gtkiconhelperprivate.h
+++ b/gtk/gtkiconhelperprivate.h
@@ -140,6 +140,9 @@ void _gtk_icon_helper_set_force_scale_pixbuf (GtkIconHelper *self,
void gtk_icon_helper_invalidate (GtkIconHelper *self);
+void gtk_icon_helper_invalidate_for_change (GtkIconHelper *self,
+ GtkCssStyleChange *change);
+
G_END_DECLS
#endif /* __GTK_ICON_HELPER_H__ */
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 32d43bd..4b1d158 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1930,8 +1930,7 @@ gtk_image_style_updated (GtkWidget *widget)
{
GtkCssStyleChange *change = gtk_style_context_get_change (context);
- if (change && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON))
- gtk_icon_helper_invalidate (priv->icon_helper);
+ gtk_icon_helper_invalidate_for_change (priv->icon_helper, change);
}
GTK_WIDGET_CLASS (gtk_image_parent_class)->style_updated (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]