[gtk+] spinbutton: Set the correct state on the button contexts



commit 998feeb2bc3e37275cfe915e128179d2704ca9c8
Author: Benjamin Otte <otte redhat com>
Date:   Thu Oct 16 17:00:20 2014 +0200

    spinbutton: Set the correct state on the button contexts
    
    With the recent save-is-child changes, using
      gtk_style_context_get_padding (context, different_state)
    will now open a subelement.
    
    This is not what we want, so we check the state whenever we get the
    button contexts.

 gtk/gtkspinbutton.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 770f242..b191784 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -922,9 +922,13 @@ gtk_spin_button_panel_get_context (GtkSpinButton *spin_button,
                                                  panel == priv->down_panel);
     }
 
+  gtk_style_context_set_state (*contextp, gtk_spin_button_panel_get_state (spin_button, panel));
+
   return *contextp;
 }
 
+#include "gtkcsssectionprivate.h"
+
 static void
 gtk_spin_button_panel_get_size (GtkSpinButton *spin_button,
                                 GdkWindow *panel,
@@ -940,7 +944,7 @@ gtk_spin_button_panel_get_size (GtkSpinButton *spin_button,
   icon_size = MAX (w, h);
 
   context = gtk_spin_button_panel_get_context (spin_button, panel);
-  state = gtk_spin_button_panel_get_state (spin_button, panel);
+  state = gtk_style_context_get_state (context);
 
   gtk_style_context_get_padding (context, state, &button_padding);
   gtk_style_context_get_border (context, state, &button_border);
@@ -1031,7 +1035,6 @@ gtk_spin_button_panel_draw (GtkSpinButton   *spin_button,
 {
   GtkSpinButtonPrivate *priv = spin_button->priv;
   GtkStyleContext *context;
-  GtkStateFlags state;
   GtkWidget *widget;
   gdouble width, height, x, y;
   gint icon_width, icon_height;
@@ -1043,8 +1046,6 @@ gtk_spin_button_panel_draw (GtkSpinButton   *spin_button,
   gtk_cairo_transform_to_window (cr, widget, panel);
 
   context = gtk_spin_button_panel_get_context (spin_button, panel);
-  state = gtk_spin_button_panel_get_state (spin_button, panel);
-  gtk_style_context_set_state (context, state);
 
   height = gdk_window_get_height (panel);
   width = gdk_window_get_width (panel);


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