[gtk] text: Fix incomplete invalidation



commit 758c54eab83b6312becea3e716e2f195204fffd1
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 22 18:01:22 2019 -0700

    text: Fix incomplete invalidation
    
    When a style change affects the text, we need to
    clear the cached content, in order to pick up the
    new text style.

 gtk/gtktext.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index af9cf73e1d..33f5082d04 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -3262,10 +3262,21 @@ static void
 gtk_text_style_updated (GtkWidget *widget)
 {
   GtkText *self = GTK_TEXT (widget);
+  GtkStyleContext *context;
+  GtkCssStyleChange *change = NULL;
+
+  context = gtk_widget_get_style_context (widget);
+  change = gtk_style_context_get_change (context);
 
   GTK_WIDGET_CLASS (gtk_text_parent_class)->style_updated (widget);
 
   gtk_text_update_cached_style_values (self);
+
+  if (change == NULL ||
+      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
+                                            GTK_CSS_AFFECTS_BACKGROUND |
+                                            GTK_CSS_AFFECTS_CONTENT))
+    gtk_text_queue_draw (GTK_WIDGET (self));
 }
 
 static void


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