[gtk+] scale: Also queue a resize if font changes



commit 3f3c1768c947f8be1a4c43111bf04a74e016ab77
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 3 10:49:29 2016 -0400

    scale: Also queue a resize if font changes
    
    As Benjamin pointed out, what AFFECTS_FONT can also affect size,
    but the implication is not automatic, so queue a resize manually.

 gtk/gtkscale.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index d2414cb..1a66d2c 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -44,6 +44,7 @@
 #include "gtkstylecontextprivate.h"
 #include "gtkstylepropertyprivate.h"
 #include "gtkwidgetprivate.h"
+#include "gtkcsswidgetnodeprivate.h"
 
 #include "a11y/gtkscaleaccessible.h"
 
@@ -1559,7 +1560,10 @@ gtk_scale_value_style_changed (GtkCssNode        *node,
   if (change == NULL ||
       gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS) ||
       gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
-    gtk_scale_clear_value_layout (scale);
+    {
+      gtk_scale_clear_value_layout (scale);
+      gtk_widget_queue_resize (GTK_WIDGET (scale));
+    }
 }
 
 static void
@@ -1570,7 +1574,16 @@ gtk_scale_mark_style_changed (GtkCssNode        *node,
   if (change == NULL ||
       gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS) ||
       gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
-    g_clear_object (&mark->layout);
+    {
+      GtkCssNode *widget_node;
+      GtkWidget *scale;
+
+      g_clear_object (&mark->layout);
+
+      widget_node = gtk_css_node_get_parent (gtk_css_node_get_parent (gtk_css_node_get_parent (node)));
+      scale = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (widget_node));
+      gtk_widget_queue_resize (GTK_WIDGET (scale));
+    }
 }
 
 static void


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