summaryrefslogtreecommitdiff
path: root/gtk/gtkspinner.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-01-24 20:54:50 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-01-24 20:55:42 -0500
commita10525661141dee57d3876f2b29bce8b03b5a39d (patch)
tree237e83683e2f0cfdfcf8e3c0db8fe0f5e274d5a4 /gtk/gtkspinner.c
parent2ee04ee8eda7ca61196f86b0bc973f0ce4af5b07 (diff)
downloadgtk+-a10525661141dee57d3876f2b29bce8b03b5a39d.tar.gz
GtkSpinner: Pay attention to style changes
Make GtkIcon redraw and resize when style changes require it.
Diffstat (limited to 'gtk/gtkspinner.c')
-rw-r--r--gtk/gtkspinner.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index 8d57a82ca0..92d6ce6b32 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -123,6 +123,29 @@ gtk_spinner_snapshot (GtkWidget *widget,
gtk_widget_get_height (widget));
}
+static void
+gtk_spinner_style_updated (GtkWidget *widget)
+{
+ GtkStyleContext *context;
+ GtkCssStyleChange *change = NULL;
+
+ context = gtk_widget_get_style_context (widget);
+ change = gtk_style_context_get_change (context);
+
+ GTK_WIDGET_CLASS (gtk_spinner_parent_class)->style_updated (widget);
+
+ if (change == NULL ||
+ gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON_SIZE))
+ {
+ gtk_widget_queue_resize (widget);
+ }
+ else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON_TEXTURE) ||
+ gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON_REDRAW))
+ {
+ gtk_widget_queue_draw (widget);
+ }
+}
+
static gboolean
gtk_spinner_get_active (GtkSpinner *spinner)
{
@@ -195,6 +218,7 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
widget_class = GTK_WIDGET_CLASS(klass);
widget_class->snapshot = gtk_spinner_snapshot;
widget_class->measure = gtk_spinner_measure;
+ widget_class->style_updated = gtk_spinner_style_updated;
/* GtkSpinner:active:
*