[gtk+/gtk-style-context: 297/347] GtkButton: Set widget state as state flags.



commit c1b52e958431f6c6a31145684c33e98b2a25ba78
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 31 14:38:26 2010 +0100

    GtkButton: Set widget state as state flags.

 gtk/gtkbutton.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 74e3565..b04fdff 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -2262,20 +2262,21 @@ static void
 gtk_button_update_state (GtkButton *button)
 {
   gboolean depressed;
-  GtkStateType new_state;
+  GtkStateFlags new_state = 0;
 
   if (button->activate_timeout)
     depressed = button->depress_on_activate;
   else
     depressed = button->in_button && button->button_down;
 
-  if (button->in_button && (!button->button_down || !depressed))
-    new_state = GTK_STATE_PRELIGHT;
-  else
-    new_state = depressed ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL;
+  if (button->in_button)
+    new_state |= GTK_STATE_FLAG_PRELIGHT;
+
+  if (button->button_down || depressed)
+    new_state |= GTK_STATE_FLAG_ACTIVE;
 
-  _gtk_button_set_depressed (button, depressed); 
-  gtk_widget_set_state (GTK_WIDGET (button), new_state);
+  _gtk_button_set_depressed (button, depressed);
+  gtk_widget_set_state_flags (GTK_WIDGET (button), new_state, TRUE);
 }
 
 static void 



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