diff options
author | Benjamin Otte <otte@redhat.com> | 2016-01-20 02:17:32 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-01-20 02:19:42 +0100 |
commit | 065aa296ed4908dff896818e9859258ab9ed9e02 (patch) | |
tree | d7129b0f6168babb913ce694ba77e6652effc9d8 | |
parent | e06c08a291d47732bce0ac1a15d0cc5c32733973 (diff) | |
download | gtk+-065aa296ed4908dff896818e9859258ab9ed9e02.tar.gz |
widget: Properly invalidate when CSS font properties change.
-rw-r--r-- | gtk/gtkwidget.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 2d9fd7fb4c..ba85df6a71 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -8112,30 +8112,22 @@ gtk_widget_real_style_updated (GtkWidget *widget) { GtkWidgetPrivate *priv = widget->priv; - gtk_widget_update_pango_context (widget); gtk_widget_update_alpha (widget); - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - if (priv->style != NULL && - priv->style != gtk_widget_get_default_style ()) - { - /* Trigger ::style-set for old - * widgets not listening to this - */ - g_signal_emit (widget, - widget_signals[STYLE_SET], - 0, - widget->priv->style); - } - G_GNUC_END_IGNORE_DEPRECATIONS; - if (widget->priv->context) { GtkCssStyleChange *change = gtk_style_context_get_change (widget->priv->context); + gboolean has_text = gtk_widget_peek_pango_context (widget) != NULL; + + if (change == NULL || + (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))) + gtk_widget_update_pango_context (widget); if (widget->priv->anchored) { - if (change == NULL || gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE)) + if (change == NULL || + gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE) || + (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))) gtk_widget_queue_resize (widget); else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_CLIP)) gtk_widget_queue_allocate (widget); @@ -8145,9 +8137,26 @@ gtk_widget_real_style_updated (GtkWidget *widget) } else { + gtk_widget_update_pango_context (widget); + if (widget->priv->anchored) gtk_widget_queue_resize (widget); } + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + if (priv->style != NULL && + priv->style != gtk_widget_get_default_style ()) + { + /* Trigger ::style-set for old + * widgets not listening to this + */ + g_signal_emit (widget, + widget_signals[STYLE_SET], + 0, + widget->priv->style); + } + G_GNUC_END_IGNORE_DEPRECATIONS; + } static gboolean |