[gtk+/native-layout] Don't use GTK_WIDGET_STATE in internal code anymore



commit 8ea37e551b1966aa2ec9d2a77f4e0efdfa2fc6d8
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Mar 3 21:49:33 2010 +0100

    Don't use GTK_WIDGET_STATE in internal code anymore
    
    Use gtk_widget_get/set_state() instead
    
    https://bugzilla.gnome.org/show_bug.cgi?id=69872

 demos/gtk-demo/drawingarea.c                |    2 +-
 docs/reference/gtk/tmpl/gtkdrawingarea.sgml |    2 +-
 docs/tutorial/gtk-tut.sgml                  |   16 +++---
 examples/scribble-simple/scribble-simple.c  |    2 +-
 examples/scribble-xinput/scribble-xinput.c  |    6 +-
 gtk/gtkaccellabel.c                         |    2 +-
 gtk/gtkbutton.c                             |    6 +-
 gtk/gtkcalendar.c                           |   18 ++++----
 gtk/gtkcellrendererpixbuf.c                 |    2 +-
 gtk/gtkcellrendererspinner.c                |    2 +-
 gtk/gtkcellrenderertext.c                   |    4 +-
 gtk/gtkcellrenderertoggle.c                 |    2 +-
 gtk/gtkcellview.c                           |    4 +-
 gtk/gtkcheckbutton.c                        |    6 +-
 gtk/gtkcheckmenuitem.c                      |   12 ++--
 gtk/gtkcombobox.c                           |   17 ++++---
 gtk/gtkentry.c                              |   68 ++++++++++++++-------------
 gtk/gtkexpander.c                           |    2 +-
 gtk/gtkhandlebox.c                          |   16 +++---
 gtk/gtkhsv.c                                |    4 +-
 gtk/gtkiconview.c                           |   12 ++--
 gtk/gtkimage.c                              |    8 ++--
 gtk/gtklabel.c                              |    4 +-
 gtk/gtklist.c                               |   10 +++-
 gtk/gtklistitem.c                           |   12 ++++-
 gtk/gtkmenu.c                               |    2 +-
 gtk/gtkmenubar.c                            |    2 +-
 gtk/gtkmenushell.c                          |    4 +-
 gtk/gtknotebook.c                           |    4 +-
 gtk/gtkoptionmenu.c                         |    6 +-
 gtk/gtkpaned.c                              |    2 +-
 gtk/gtkpixmap.c                             |    2 +-
 gtk/gtkradiobutton.c                        |    4 +-
 gtk/gtkrange.c                              |    2 +-
 gtk/gtkruler.c                              |    4 +-
 gtk/gtkseparator.c                          |    8 ++--
 gtk/gtkspinbutton.c                         |    2 +-
 gtk/gtkstatusbar.c                          |    2 +-
 gtk/gtktext.c                               |   16 +++---
 gtk/gtktextutil.c                           |    8 ++--
 gtk/gtktextview.c                           |   20 ++++----
 gtk/gtktogglebutton.c                       |    2 +-
 gtk/gtktoolbar.c                            |   10 ++--
 gtk/gtktrayicon-x11.c                       |    2 +-
 gtk/gtktreeitem.c                           |    2 +-
 gtk/gtktreeview.c                           |   25 +++++-----
 gtk/gtktreeviewcolumn.c                     |    2 +-
 gtk/gtkwidget.c                             |   26 +++++-----
 gtk/gtkwidget.h                             |    3 +-
 modules/other/gail/gailbutton.c             |    4 +-
 tests/testgtk.c                             |    2 +-
 tests/testinput.c                           |    8 ++--
 tests/testtext.c                            |    2 +-
 53 files changed, 218 insertions(+), 197 deletions(-)
---
diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c
index 7c3101a..03e4ddc 100644
--- a/demos/gtk-demo/drawingarea.c
+++ b/demos/gtk-demo/drawingarea.c
@@ -57,7 +57,7 @@ scribble_expose_event (GtkWidget      *widget,
    */
 
   gdk_draw_drawable (widget->window,
-                     widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+                     widget->style->fg_gc[gtk_widget_get_state (widget)],
                      pixmap,
                      /* Only copy the area that was exposed. */
                      event->area.x, event->area.y,
diff --git a/docs/reference/gtk/tmpl/gtkdrawingarea.sgml b/docs/reference/gtk/tmpl/gtkdrawingarea.sgml
index 09be147..dee937a 100644
--- a/docs/reference/gtk/tmpl/gtkdrawingarea.sgml
+++ b/docs/reference/gtk/tmpl/gtkdrawingarea.sgml
@@ -56,7 +56,7 @@ gboolean
 expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 {
   gdk_draw_arc (widget->window,
-                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+                widget->style->fg_gc[gtk_widget_get_state (widget)],
                 TRUE,
                 0, 0, widget->allocation.width, widget->allocation.height,
                 0, 64 * 360);
diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml
index 3eee1bd..eaa66a9 100755
--- a/docs/tutorial/gtk-tut.sgml
+++ b/docs/tutorial/gtk-tut.sgml
@@ -12777,7 +12777,7 @@ static gboolean
 expose_event( GtkWidget *widget, GdkEventExpose *event )
 {
   gdk_draw_drawable(widget->window,
-		    widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+		    widget->style->fg_gc[gtk_widget_get_state (widget)],
 		    pixmap,
 		    event->area.x, event->area.y,
 		    event->area.x, event->area.y,
@@ -12837,7 +12837,7 @@ contexts are:</para>
 widget->style->white_gc
 widget->style->black_gc
 widget->style->fg_gc[GTK_STATE_NORMAL]
-widget->style->bg_gc[GTK_WIDGET_STATE(widget)]
+widget->style->bg_gc[gtk_widget_get_state(widget)]
 </programlisting>
 
 <para>The fields <literal>fg_gc</literal>, <literal>bg_gc</literal>, <literal>dark_gc</literal>, and
@@ -13139,7 +13139,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
   switch (source)
     {
     case GDK_SOURCE_MOUSE:
-      gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget->style->dark_gc[gtk_widget_get_state (widget)];
       break;
     case GDK_SOURCE_PEN:
       gc = widget->style->black_gc;
@@ -13148,7 +13148,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
       gc = widget->style->white_gc;
       break;
     default:
-      gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget->style->light_gc[gtk_widget_get_state (widget)];
     }
 
   update_rect.x = x - 10 * pressure;
@@ -15706,7 +15706,7 @@ static gboolean expose_event( GtkWidget      *widget,
                               GdkEventExpose *event )
 {
   gdk_draw_drawable (widget-&gt;window,
-		     widget-&gt;style-&gt;fg_gc[GTK_WIDGET_STATE (widget)],
+		     widget-&gt;style-&gt;fg_gc[gtk_widget_get_state (widget)],
 		     pixmap,
 		     event-&gt;area.x, event-&gt;area.y,
 		     event-&gt;area.x, event-&gt;area.y,
@@ -15897,7 +15897,7 @@ static gboolean
 expose_event (GtkWidget *widget, GdkEventExpose *event)
 {
   gdk_draw_drawable (widget-&gt;window,
-                     widget-&gt;style-&gt;fg_gc[GTK_WIDGET_STATE (widget)],
+                     widget-&gt;style-&gt;fg_gc[gtk_widget_get_state (widget)],
                      pixmap,
                      event-&gt;area.x, event-&gt;area.y,
                      event-&gt;area.x, event-&gt;area.y,
@@ -15918,7 +15918,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
   switch (source)
     {
     case GDK_SOURCE_MOUSE:
-      gc = widget-&gt;style-&gt;dark_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget-&gt;style-&gt;dark_gc[gtk_widget_get_state (widget)];
       break;
     case GDK_SOURCE_PEN:
       gc = widget-&gt;style-&gt;black_gc;
@@ -15927,7 +15927,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
       gc = widget-&gt;style-&gt;white_gc;
       break;
     default:
-      gc = widget-&gt;style-&gt;light_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget-&gt;style-&gt;light_gc[gtk_widget_get_state (widget)];
     }
 
   update_rect.x = x - 10 * pressure;
diff --git a/examples/scribble-simple/scribble-simple.c b/examples/scribble-simple/scribble-simple.c
index 069eea1..a0cfc21 100644
--- a/examples/scribble-simple/scribble-simple.c
+++ b/examples/scribble-simple/scribble-simple.c
@@ -50,7 +50,7 @@ static gboolean expose_event( GtkWidget      *widget,
                               GdkEventExpose *event )
 {
   gdk_draw_drawable (widget->window,
-		     widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+		     widget->style->fg_gc[gtk_widget_get_state (widget)],
 		     pixmap,
 		     event->area.x, event->area.y,
 		     event->area.x, event->area.y,
diff --git a/examples/scribble-xinput/scribble-xinput.c b/examples/scribble-xinput/scribble-xinput.c
index 697969e..469ee31 100644
--- a/examples/scribble-xinput/scribble-xinput.c
+++ b/examples/scribble-xinput/scribble-xinput.c
@@ -49,7 +49,7 @@ static gboolean
 expose_event (GtkWidget *widget, GdkEventExpose *event)
 {
   gdk_draw_drawable (widget->window,
-                     widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+                     widget->style->fg_gc[gtk_widget_get_state (widget)],
                      pixmap,
                      event->area.x, event->area.y,
                      event->area.x, event->area.y,
@@ -70,7 +70,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
   switch (source)
     {
     case GDK_SOURCE_MOUSE:
-      gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget->style->dark_gc[gtk_widget_get_state (widget)];
       break;
     case GDK_SOURCE_PEN:
       gc = widget->style->black_gc;
@@ -79,7 +79,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
       gc = widget->style->white_gc;
       break;
     default:
-      gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget->style->light_gc[gtk_widget_get_state (widget)];
     }
 
   update_rect.x = x - 10 * pressure;
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 56b1a83..da982bd 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -413,7 +413,7 @@ gtk_accel_label_expose_event (GtkWidget      *widget,
 
           gtk_paint_layout (widget->style,
                             widget->window,
-                            GTK_WIDGET_STATE (widget),
+                            gtk_widget_get_state (widget),
 			    FALSE,
                             &event->area,
                             widget,
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 47819ce..5b328ae 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1520,7 +1520,7 @@ _gtk_button_paint (GtkButton          *button,
 	}
 
       if (button->relief != GTK_RELIEF_NONE || button->depressed ||
-	  GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT)
+	  gtk_widget_get_state(widget) == GTK_STATE_PRELIGHT)
 	gtk_paint_box (widget->style, widget->window,
 		       state_type,
 		       shadow_type, area, widget, "button",
@@ -1559,7 +1559,7 @@ _gtk_button_paint (GtkButton          *button,
 	      y += child_displacement_y;
 	    }
 
-	  gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+	  gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
 			   area, widget, "button",
 			   x, y, width, height);
 	}
@@ -1575,7 +1575,7 @@ gtk_button_expose (GtkWidget      *widget,
       GtkButton *button = GTK_BUTTON (widget);
       
       _gtk_button_paint (button, &event->area,
-			 GTK_WIDGET_STATE (widget),
+			 gtk_widget_get_state (widget),
 			 button->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
 			 "button", "buttondefault");
 
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 37d55c3..80f67d3 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -186,16 +186,16 @@ dates_difference(guint year1, guint mm1, guint dd1,
 #define SCROLL_DELAY_FACTOR      5
 
 /* Color usage */
-#define HEADER_FG_COLOR(widget)		 (& (widget)->style->fg[GTK_WIDGET_STATE (widget)])
-#define HEADER_BG_COLOR(widget)		 (& (widget)->style->bg[GTK_WIDGET_STATE (widget)])
+#define HEADER_FG_COLOR(widget)		 (& (widget)->style->fg[gtk_widget_get_state (widget)])
+#define HEADER_BG_COLOR(widget)		 (& (widget)->style->bg[gtk_widget_get_state (widget)])
 #define SELECTED_BG_COLOR(widget)	 (& (widget)->style->base[gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE])
 #define SELECTED_FG_COLOR(widget)	 (& (widget)->style->text[gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE])
-#define NORMAL_DAY_COLOR(widget)	 (& (widget)->style->text[GTK_WIDGET_STATE (widget)])
-#define PREV_MONTH_COLOR(widget)	 (& (widget)->style->mid[GTK_WIDGET_STATE (widget)])
-#define NEXT_MONTH_COLOR(widget)	 (& (widget)->style->mid[GTK_WIDGET_STATE (widget)])
-#define MARKED_COLOR(widget)		 (& (widget)->style->text[GTK_WIDGET_STATE (widget)])
-#define BACKGROUND_COLOR(widget)	 (& (widget)->style->base[GTK_WIDGET_STATE (widget)])
-#define HIGHLIGHT_BACK_COLOR(widget)	 (& (widget)->style->mid[GTK_WIDGET_STATE (widget)])
+#define NORMAL_DAY_COLOR(widget)	 (& (widget)->style->text[gtk_widget_get_state (widget)])
+#define PREV_MONTH_COLOR(widget)	 (& (widget)->style->mid[gtk_widget_get_state (widget)])
+#define NEXT_MONTH_COLOR(widget)	 (& (widget)->style->mid[gtk_widget_get_state (widget)])
+#define MARKED_COLOR(widget)		 (& (widget)->style->text[gtk_widget_get_state (widget)])
+#define BACKGROUND_COLOR(widget)	 (& (widget)->style->base[gtk_widget_get_state (widget)])
+#define HIGHLIGHT_BACK_COLOR(widget)	 (& (widget)->style->mid[gtk_widget_get_state (widget)])
 
 enum {
   ARROW_YEAR_LEFT,
@@ -2685,7 +2685,7 @@ gtk_calendar_expose (GtkWidget	    *widget,
 	calendar_paint_week_numbers (calendar);
       if (event->window == widget->window)
 	{
-	  gtk_paint_shadow (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+	  gtk_paint_shadow (widget->style, widget->window, gtk_widget_get_state (widget),
 			    GTK_SHADOW_IN, NULL, widget, "calendar",
 			    0, 0, widget->allocation.width, widget->allocation.height);
 	}
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index 902b0d4..f689784 100644
--- a/gtk/gtkcellrendererpixbuf.c
+++ b/gtk/gtkcellrendererpixbuf.c
@@ -714,7 +714,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
   if (!pixbuf)
     return;
 
-  if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
+  if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
     {
       GtkIconSource *source;
       
diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c
index fe1d8d9..834433d 100644
--- a/gtk/gtkcellrendererspinner.c
+++ b/gtk/gtkcellrendererspinner.c
@@ -360,7 +360,7 @@ gtk_cell_renderer_spinner_render (GtkCellRenderer *cellr,
     }
 
   state = GTK_STATE_NORMAL;
-  if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cellr->sensitive)
+  if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cellr->sensitive)
     {
       state = GTK_STATE_INSENSITIVE;
     }
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index cc12a0a..8529c08 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -1649,13 +1649,13 @@ gtk_cell_renderer_text_render (GtkCellRenderer      *cell,
 	state = GTK_STATE_ACTIVE;
     }
   else if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT &&
-	   GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
+	   gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
     {
       state = GTK_STATE_PRELIGHT;
     }
   else
     {
-      if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+      if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
 	state = GTK_STATE_INSENSITIVE;
       else
 	state = GTK_STATE_NORMAL;
diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c
index 7d3eb88..4282131 100644
--- a/gtk/gtkcellrenderertoggle.c
+++ b/gtk/gtkcellrenderertoggle.c
@@ -349,7 +349,7 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer      *cell,
   else
     shadow = celltoggle->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
 
-  if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
+  if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
     {
       state = GTK_STATE_INSENSITIVE;
     }
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 382cc6e..57c526b 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -473,9 +473,9 @@ gtk_cell_view_expose (GtkWidget      *widget,
   area.x = widget->allocation.x + (rtl ? widget->allocation.width : 0); 
   area.y = widget->allocation.y;
 
-  if (GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
+  if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
     state = GTK_CELL_RENDERER_PRELIT;
-  else if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+  else if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
     state = GTK_CELL_RENDERER_INSENSITIVE;
   else
     state = 0;
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index ed94e3c..e765653 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -154,14 +154,14 @@ gtk_check_button_paint (GtkWidget    *widget,
 	  GtkWidget *child = GTK_BIN (widget)->child;
 	  
 	  if (interior_focus && child && gtk_widget_get_visible (child))
-	    gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+	    gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
 			     area, widget, "checkbutton",
 			     child->allocation.x - focus_width - focus_pad,
 			     child->allocation.y - focus_width - focus_pad,
 			     child->allocation.width + 2 * (focus_width + focus_pad),
 			     child->allocation.height + 2 * (focus_width + focus_pad));
 	  else
-	    gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), 
+	    gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
 			     area, widget, "checkbutton",
 			     border_width + widget->allocation.x,
 			     border_width + widget->allocation.y,
@@ -398,7 +398,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
 	x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
 
-      if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
+      if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
 	{
 	  GdkRectangle restrict_area;
 	  GdkRectangle new_area;
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index 1009833..8c77d61 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -441,17 +441,17 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
   GtkShadowType shadow_type;
   gint x, y;
 
-  if (gtk_widget_is_drawable (GTK_WIDGET (check_menu_item)))
+  widget = GTK_WIDGET (check_menu_item);
+
+  if (gtk_widget_is_drawable (widget))
     {
       guint offset;
       guint toggle_size;
       guint toggle_spacing;
       guint horizontal_padding;
       guint indicator_size;
-      
-      widget = GTK_WIDGET (check_menu_item);
 
-      gtk_widget_style_get (GTK_WIDGET (check_menu_item),
+      gtk_widget_style_get (widget,
  			    "toggle-spacing", &toggle_spacing,
  			    "horizontal-padding", &horizontal_padding,
 			    "indicator-size", &indicator_size,
@@ -477,9 +477,9 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
 
       if (check_menu_item->active ||
 	  check_menu_item->always_show_toggle ||
-	  (GTK_WIDGET_STATE (check_menu_item) == GTK_STATE_PRELIGHT))
+	  (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT))
 	{
-	  state_type = GTK_WIDGET_STATE (widget);
+	  state_type = gtk_widget_get_state (widget);
 	  
 	  if (check_menu_item->inconsistent)
 	    shadow_type = GTK_SHADOW_ETCHED_IN;
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 92959b4..fd92dd0 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1100,7 +1100,7 @@ gtk_combo_box_state_changed (GtkWidget    *widget,
     {
       if (priv->tree_view && priv->cell_view)
 	gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view), 
-					    &widget->style->base[GTK_WIDGET_STATE (widget)]);
+					    &widget->style->base[gtk_widget_get_state (widget)]);
     }
 
   gtk_widget_queue_draw (widget);
@@ -1118,12 +1118,12 @@ gtk_combo_box_button_state_changed (GtkWidget    *widget,
     {
       if (!priv->tree_view && priv->cell_view)
 	{
-	  if ((GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE) !=
-	      (GTK_WIDGET_STATE (priv->cell_view) == GTK_STATE_INSENSITIVE))
+	  if ((gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) !=
+	      (gtk_widget_get_state (priv->cell_view) == GTK_STATE_INSENSITIVE))
 	    gtk_widget_set_sensitive (priv->cell_view, gtk_widget_get_sensitive (widget));
 	  
 	  gtk_widget_set_state (priv->cell_view, 
-				GTK_WIDGET_STATE (widget));
+				gtk_widget_get_state (widget));
 	}
     }
 
@@ -1183,7 +1183,7 @@ gtk_combo_box_style_set (GtkWidget *widget,
 
   if (priv->tree_view && priv->cell_view)
     gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view), 
-					&widget->style->base[GTK_WIDGET_STATE (widget)]);
+					&widget->style->base[gtk_widget_get_state (widget)]);
 
   if (GTK_IS_ENTRY (GTK_BIN (combo_box)->child))
     g_object_set (GTK_BIN (combo_box)->child, "shadow-type",
@@ -3675,6 +3675,8 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
   GtkTreeSelection *sel;
+  GtkStyle *style;
+  GtkWidget *widget = GTK_WIDGET (combo_box);
 
   priv->button = gtk_toggle_button_new ();
   gtk_widget_set_parent (priv->button,
@@ -3691,8 +3693,9 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
 
   if (priv->cell_view)
     {
-      gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view), 
-					  &GTK_WIDGET (combo_box)->style->base[GTK_WIDGET_STATE (combo_box)]);
+      style = gtk_widget_get_style (widget);
+      gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
+                                          &style->base[gtk_widget_get_state (widget)]);
 
       priv->box = gtk_event_box_new ();
       gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->box), 
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index c4aeb66..1a94424 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2674,7 +2674,7 @@ realize_icon_info (GtkWidget            *widget,
                                       attributes_mask);
   gdk_window_set_user_data (icon_info->window, widget);
   gdk_window_set_background (icon_info->window,
-                             &widget->style->base[GTK_WIDGET_STATE (widget)]);
+                             &widget->style->base[gtk_widget_get_state (widget)]);
 
   gtk_widget_queue_resize (widget);
 }
@@ -2796,8 +2796,8 @@ gtk_entry_realize (GtkWidget *widget)
 
   widget->style = gtk_style_attach (widget->style, widget->window);
 
-  gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
-  gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+  gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
+  gdk_window_set_background (entry->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
 
   gdk_window_show (entry->text_area);
 
@@ -3305,7 +3305,7 @@ gtk_entry_draw_frame (GtkWidget      *widget,
   gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
   if (state_hint)
       state = gtk_widget_has_focus (widget) ?
-        GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
+        GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
   else
       state = GTK_STATE_NORMAL;
 
@@ -3323,7 +3323,8 @@ gtk_entry_draw_frame (GtkWidget      *widget,
       width += 2 * priv->focus_width;
       height += 2 * priv->focus_width;
       
-      gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), 
+      gtk_paint_focus (widget->style, widget->window,
+                       gtk_widget_get_state (widget),
 		       &event->area, widget, "entry",
 		       0, 0, width, height);
     }
@@ -3455,9 +3456,9 @@ gtk_entry_expose (GtkWidget      *widget,
   gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
   if (state_hint)
     state = gtk_widget_has_focus (widget) ?
-      GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
+      GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
   else
-    state = GTK_WIDGET_STATE(widget);
+    state = gtk_widget_get_state(widget);
 
   if (widget->window == event->window)
     {
@@ -3502,7 +3503,7 @@ gtk_entry_expose (GtkWidget      *widget,
               gdk_drawable_get_size (icon_info->window, &width, &height);
 
               gtk_paint_flat_box (widget->style, icon_info->window,
-                                  GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
+                                  gtk_widget_get_state (widget), GTK_SHADOW_NONE,
                                   NULL, widget, "entry_bg",
                                   0, 0, width, height);
 
@@ -4244,13 +4245,13 @@ gtk_entry_state_changed (GtkWidget      *widget,
   
   if (gtk_widget_get_realized (widget))
     {
-      gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
-      gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+      gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
+      gdk_window_set_background (entry->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
       for (i = 0; i < MAX_ICONS; i++) 
         {
           EntryIconInfo *icon_info = priv->icons[i];
           if (icon_info && icon_info->window)
-            gdk_window_set_background (icon_info->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+            gdk_window_set_background (icon_info->window, &widget->style->base[gtk_widget_get_state (widget)]);
         }
 
       if (gtk_widget_is_sensitive (widget))
@@ -4462,13 +4463,13 @@ gtk_entry_style_set (GtkWidget *widget,
 
   if (previous_style && gtk_widget_get_realized (widget))
     {
-      gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
-      gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+      gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
+      gdk_window_set_background (entry->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
       for (i = 0; i < MAX_ICONS; i++) 
         {
           EntryIconInfo *icon_info = priv->icons[i];
           if (icon_info && icon_info->window)
-            gdk_window_set_background (icon_info->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+            gdk_window_set_background (icon_info->window, &widget->style->base[gtk_widget_get_state (widget)]);
         }
     }
 
@@ -6448,38 +6449,41 @@ gtk_entry_ensure_pixbuf (GtkEntry             *entry,
 {
   GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
   EntryIconInfo *icon_info = priv->icons[icon_pos];
-  GdkScreen *screen;
+  GtkIconInfo *info;
   GtkIconTheme *icon_theme;
   GtkSettings *settings;
+  GtkStateType state;
+  GtkWidget *widget;
+  GdkScreen *screen;
   gint width, height;
-  GtkIconInfo *info;
-  gint state;
 
   if (!icon_info || icon_info->pixbuf)
     return;
 
+  widget = GTK_WIDGET (entry);
+
   switch (icon_info->storage_type)
     {
     case GTK_IMAGE_EMPTY:
     case GTK_IMAGE_PIXBUF:
       break;
     case GTK_IMAGE_STOCK:
-      state = GTK_WIDGET_STATE (entry);
-      GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL;
-      icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
+      state = gtk_widget_get_state (widget);
+      gtk_widget_set_state (widget, GTK_STATE_NORMAL);
+      icon_info->pixbuf = gtk_widget_render_icon (widget,
                                                   icon_info->stock_id,
                                                   GTK_ICON_SIZE_MENU,
                                                   NULL);
       if (!icon_info->pixbuf)
-        icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
+        icon_info->pixbuf = gtk_widget_render_icon (widget,
                                                     GTK_STOCK_MISSING_IMAGE,
                                                     GTK_ICON_SIZE_MENU,
                                                     NULL);
-      GTK_WIDGET_STATE (entry) = state;
+      gtk_widget_set_state (widget, state);
       break;
 
     case GTK_IMAGE_ICON_NAME:
-      screen = gtk_widget_get_screen (GTK_WIDGET (entry));
+      screen = gtk_widget_get_screen (widget);
       if (screen)
         {
           icon_theme = gtk_icon_theme_get_for_screen (screen);
@@ -6496,19 +6500,19 @@ gtk_entry_ensure_pixbuf (GtkEntry             *entry,
 
           if (icon_info->pixbuf == NULL)
             {
-              state = GTK_WIDGET_STATE (entry);
-              GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL;
-              icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
+              state = gtk_widget_get_state (widget);
+              gtk_widget_set_state (widget, GTK_STATE_NORMAL);
+              icon_info->pixbuf = gtk_widget_render_icon (widget,
                                                           GTK_STOCK_MISSING_IMAGE,
                                                           GTK_ICON_SIZE_MENU,
                                                           NULL);
-              GTK_WIDGET_STATE (entry) = state;
+              gtk_widget_set_state (widget, state);
             }
         }
       break;
 
     case GTK_IMAGE_GICON:
-      screen = gtk_widget_get_screen (GTK_WIDGET (entry));
+      screen = gtk_widget_get_screen (widget);
       if (screen)
         {
           icon_theme = gtk_icon_theme_get_for_screen (screen);
@@ -6530,13 +6534,13 @@ gtk_entry_ensure_pixbuf (GtkEntry             *entry,
 
           if (icon_info->pixbuf == NULL)
             {
-              state = GTK_WIDGET_STATE (entry);
-              GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL;
-              icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
+              state = gtk_widget_get_state (widget);
+              gtk_widget_set_state (widget, GTK_STATE_NORMAL);
+              icon_info->pixbuf = gtk_widget_render_icon (widget,
                                                           GTK_STOCK_MISSING_IMAGE,
                                                           GTK_ICON_SIZE_MENU,
                                                           NULL);
-              GTK_WIDGET_STATE (entry) = state;
+              gtk_widget_set_state (widget, state);
             }
         }
       break;
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index df64e54..b7a61f7 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -888,7 +888,7 @@ gtk_expander_paint_focus (GtkExpander  *expander,
       height = rect.height + 2 * focus_pad;
     }
       
-  gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+  gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
 		   area, widget, "expander",
 		   x, y, width, height);
 }
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index 25d61aa..5ff6050 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -450,9 +450,9 @@ gtk_handle_box_realize (GtkWidget *widget)
   gdk_window_set_type_hint (hb->float_window, GDK_WINDOW_TYPE_HINT_TOOLBAR);
   
   widget->style = gtk_style_attach (widget->style, widget->window);
-  gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (hb));
-  gtk_style_set_background (widget->style, hb->bin_window, GTK_WIDGET_STATE (hb));
-  gtk_style_set_background (widget->style, hb->float_window, GTK_WIDGET_STATE (hb));
+  gtk_style_set_background (widget->style, widget->window, gtk_widget_get_state (widget));
+  gtk_style_set_background (widget->style, hb->bin_window, gtk_widget_get_state (widget));
+  gtk_style_set_background (widget->style, hb->float_window, gtk_widget_get_state (widget));
   gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
 }
 
@@ -716,7 +716,7 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
     }
   gtk_paint_shadow (widget->style,
 		    widget->window,
-		    GTK_WIDGET_STATE (widget),
+		    gtk_widget_get_state (widget),
 		    GTK_SHADOW_ETCHED_IN,
 		    NULL, widget, "handle",
 		    x,
@@ -727,7 +727,7 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
        handle_position == GTK_POS_RIGHT)
      gtk_paint_hline (widget->style,
 		      widget->window,
-		      GTK_WIDGET_STATE (widget),
+		      gtk_widget_get_state (widget),
 		      NULL, widget, "handlebox",
 		      handle_position == GTK_POS_LEFT ? DRAG_HANDLE_SIZE : 0,
 		      handle_position == GTK_POS_LEFT ? widget->allocation.width : widget->allocation.width - DRAG_HANDLE_SIZE,
@@ -735,7 +735,7 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
    else
      gtk_paint_vline (widget->style,
 		      widget->window,
-		      GTK_WIDGET_STATE (widget),
+		      gtk_widget_get_state (widget),
 		      NULL, widget, "handlebox",
 		      handle_position == GTK_POS_TOP ? DRAG_HANDLE_SIZE : 0,
 		      handle_position == GTK_POS_TOP ? widget->allocation.height : widget->allocation.height - DRAG_HANDLE_SIZE,
@@ -890,14 +890,14 @@ gtk_handle_box_paint (GtkWidget      *widget,
   if (!event)
     gtk_paint_box (widget->style,
 		   hb->bin_window,
-		   GTK_WIDGET_STATE (widget),
+		   gtk_widget_get_state (widget),
 		   hb->shadow_type,
 		   area, widget, "handlebox_bin",
 		   0, 0, -1, -1);
   else
    gtk_paint_box (widget->style,
 		  hb->bin_window,
-		  GTK_WIDGET_STATE (widget),
+		  gtk_widget_get_state (widget),
 		  hb->shadow_type,
 		  &event->area, widget, "handlebox_bin",
 		  0, 0, -1, -1);
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c
index a9b4bb5..a8a22cb 100644
--- a/gtk/gtkhsv.c
+++ b/gtk/gtkhsv.c
@@ -1235,7 +1235,7 @@ paint_triangle (GtkHSV      *hsv,
 			    NULL);
   
       gtk_paint_focus (widget->style, widget->window,
-		       GTK_WIDGET_STATE (widget),
+		       gtk_widget_get_state (widget),
 		       NULL, widget, detail,
 		       widget->allocation.x + xx - FOCUS_RADIUS - focus_width - focus_pad, 
 		       widget->allocation.y + yy - FOCUS_RADIUS - focus_width - focus_pad, 
@@ -1293,7 +1293,7 @@ gtk_hsv_expose (GtkWidget      *widget,
 
   if (gtk_widget_has_focus (widget) && priv->focus_on_ring)
     gtk_paint_focus (widget->style, widget->window,
-		     GTK_WIDGET_STATE (widget),
+		     gtk_widget_get_state (widget),
 		     &event->area, widget, NULL,
 		     widget->allocation.x,
 		     widget->allocation.y, 
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 24718bd..ebb63a1 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1592,7 +1592,7 @@ gtk_icon_view_expose (GtkWidget *widget,
 	case GTK_ICON_VIEW_DROP_INTO:
 	  gtk_paint_focus (widget->style,
 			   icon_view->priv->bin_window,
-			   GTK_WIDGET_STATE (widget),
+			   gtk_widget_get_state (widget),
 			   NULL,
 			   widget,
 			   "iconview-drop-indicator",
@@ -1602,7 +1602,7 @@ gtk_icon_view_expose (GtkWidget *widget,
 	case GTK_ICON_VIEW_DROP_ABOVE:
 	  gtk_paint_focus (widget->style,
 			   icon_view->priv->bin_window,
-			   GTK_WIDGET_STATE (widget),
+			   gtk_widget_get_state (widget),
 			   NULL,
 			   widget,
 			   "iconview-drop-indicator",
@@ -1612,7 +1612,7 @@ gtk_icon_view_expose (GtkWidget *widget,
 	case GTK_ICON_VIEW_DROP_LEFT:
 	  gtk_paint_focus (widget->style,
 			   icon_view->priv->bin_window,
-			   GTK_WIDGET_STATE (widget),
+			   gtk_widget_get_state (widget),
 			   NULL,
 			   widget,
 			   "iconview-drop-indicator",
@@ -1622,7 +1622,7 @@ gtk_icon_view_expose (GtkWidget *widget,
 	case GTK_ICON_VIEW_DROP_BELOW:
 	  gtk_paint_focus (widget->style,
 			   icon_view->priv->bin_window,
-			   GTK_WIDGET_STATE (widget),
+			   gtk_widget_get_state (widget),
 			   NULL,
 			   widget,
 			   "iconview-drop-indicator",
@@ -1632,7 +1632,7 @@ gtk_icon_view_expose (GtkWidget *widget,
 	case GTK_ICON_VIEW_DROP_RIGHT:
 	  gtk_paint_focus (widget->style,
 			   icon_view->priv->bin_window,
-			   GTK_WIDGET_STATE (widget),
+			   gtk_widget_get_state (widget),
 			   NULL,
 			   widget,
 			   "iconview-drop-indicator",
@@ -7397,7 +7397,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
 	  cairo_set_line_width (cr, 1.);
 
 	  gdk_cairo_set_source_color
-	    (cr, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+	    (cr, &widget->style->base[gtk_widget_get_state (widget)]);
 	  cairo_rectangle (cr, 0, 0, item->width + 2, item->height + 2);
 	  cairo_fill (cr);
 
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index d316dc3..6654f0d 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1883,7 +1883,7 @@ gtk_image_expose (GtkWidget      *widget,
 
       mask = NULL;
       pixbuf = NULL;
-      needs_state_transform = GTK_WIDGET_STATE (widget) != GTK_STATE_NORMAL;
+      needs_state_transform = gtk_widget_get_state (widget) != GTK_STATE_NORMAL;
       
       switch (image->storage_type)
         {
@@ -1971,7 +1971,7 @@ gtk_image_expose (GtkWidget      *widget,
             gtk_icon_set_render_icon (image->data.icon_set.icon_set,
                                       widget->style,
                                       gtk_widget_get_direction (widget),
-                                      GTK_WIDGET_STATE (widget),
+                                      gtk_widget_get_state (widget),
                                       image->icon_size,
                                       widget,
                                       NULL);
@@ -2066,7 +2066,7 @@ gtk_image_expose (GtkWidget      *widget,
                   rendered = gtk_style_render_icon (widget->style,
                                                     source,
                                                     gtk_widget_get_direction (widget),
-                                                    GTK_WIDGET_STATE (widget),
+                                                    gtk_widget_get_state (widget),
                                                     /* arbitrary */
                                                     (GtkIconSize)-1,
                                                     widget,
@@ -2319,7 +2319,7 @@ gtk_image_calc_size (GtkImage *image)
       pixbuf = gtk_icon_set_render_icon (image->data.icon_set.icon_set,
                                          widget->style,
                                          gtk_widget_get_direction (widget),
-                                         GTK_WIDGET_STATE (widget),
+                                         gtk_widget_get_state (widget),
                                          image->icon_size,
                                          widget,
                                          NULL);
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 46c072e..2759bb2 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3721,7 +3721,7 @@ gtk_label_expose (GtkWidget      *widget,
 
       gtk_paint_layout (widget->style,
                         widget->window,
-                        GTK_WIDGET_STATE (widget),
+                        gtk_widget_get_state (widget),
 			FALSE,
                         &event->area,
                         widget,
@@ -3835,7 +3835,7 @@ gtk_label_expose (GtkWidget      *widget,
                                                        1);
               gdk_region_get_clipbox (clip, &rect);
 
-              gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+              gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
                                &event->area, widget, "label",
                                rect.x, rect.y, rect.width, rect.height);
 
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index b792e48..db4c665 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -785,8 +785,14 @@ static void
 gtk_list_style_set	(GtkWidget      *widget,
 			 GtkStyle       *previous_style)
 {
+  GtkStyle *style;
+
   if (previous_style && gtk_widget_get_realized (widget))
-    gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+    {
+      style = gtk_widget_get_style (widget);
+      gdk_window_set_background (gtk_widget_get_window (widget),
+                                 &style->base[gtk_widget_get_state (widget)]);
+    }
 }
 
 /* GtkContainer Methods :
@@ -1456,7 +1462,7 @@ gtk_list_select_all (GtkList *list)
       list->undo_unselection = NULL;
 
       if (list->children &&
-	  GTK_WIDGET_STATE (list->children->data) != GTK_STATE_SELECTED)
+	  gtk_widget_get_state (list->children->data) != GTK_STATE_SELECTED)
 	gtk_list_fake_toggle_row (list, GTK_WIDGET (list->children->data));
 
       list->anchor_state =  GTK_STATE_SELECTED;
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index d013462..4615841 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -527,10 +527,16 @@ static void
 gtk_list_item_style_set	(GtkWidget      *widget,
 			 GtkStyle       *previous_style)
 {
+  GtkStyle *style;
+
   g_return_if_fail (widget != NULL);
 
   if (previous_style && gtk_widget_get_realized (widget))
-    gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+    {
+      style = gtk_widget_get_style (widget);
+      gdk_window_set_background (gtk_widget_get_window (widget),
+                                 &style->base[gtk_widget_get_state (widget)]);
+    }
 }
 
 static gint
@@ -570,11 +576,11 @@ gtk_list_item_expose (GtkWidget      *widget,
       if (gtk_widget_has_focus (widget))
         {
           if (GTK_IS_LIST (widget->parent) && GTK_LIST (widget->parent)->add_mode)
-            gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+            gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
                              NULL, widget, "add-mode",
                              0, 0, widget->allocation.width, widget->allocation.height);
           else
-            gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+            gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
                              NULL, widget, NULL,
                              0, 0, widget->allocation.width, widget->allocation.height);
         }
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index cbc95ad..62039fe 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1210,7 +1210,7 @@ gtk_menu_attach_to_widget (GtkMenu	       *menu,
   g_object_set_data_full (G_OBJECT (attach_widget), I_(ATTACHED_MENUS), list,
                           (GDestroyNotify) g_list_free);
 
-  if (GTK_WIDGET_STATE (menu) != GTK_STATE_NORMAL)
+  if (gtk_widget_get_state (GTK_WIDGET (menu)) != GTK_STATE_NORMAL)
     gtk_widget_set_state (GTK_WIDGET (menu), GTK_STATE_NORMAL);
   
   /* we don't need to set the style here, since
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 1fad524..1332975 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -517,7 +517,7 @@ gtk_menu_bar_paint (GtkWidget    *widget,
       
       gtk_paint_box (widget->style,
 		     widget->window,
-                     GTK_WIDGET_STATE (widget),
+                     gtk_widget_get_state (widget),
                      get_shadow_type (GTK_MENU_BAR (widget)),
 		     area, widget, "menubar",
 		     border, border,
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 4788590..bc8ea19 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -903,7 +903,7 @@ gtk_menu_shell_enter_notify (GtkWidget        *widget,
 
 	  if (event->detail != GDK_NOTIFY_INFERIOR)
             {
-	      if (GTK_WIDGET_STATE (menu_item) != GTK_STATE_PRELIGHT)
+	      if (gtk_widget_get_state (menu_item) != GTK_STATE_PRELIGHT)
                 gtk_menu_shell_select_item (menu_shell, menu_item);
 
               /* If any mouse button is down, and there is a submenu
@@ -972,7 +972,7 @@ gtk_menu_shell_leave_notify (GtkWidget        *widget,
 	  (menu_item->submenu == NULL))
 	{
 	  if ((event->detail != GDK_NOTIFY_INFERIOR) &&
-	      (GTK_WIDGET_STATE (menu_item) != GTK_STATE_NORMAL))
+	      (gtk_widget_get_state (GTK_WIDGET (menu_item)) != GTK_STATE_NORMAL))
 	    {
 	      gtk_menu_shell_deselect (menu_shell);
 	    }
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index aa42268..85dd974 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -3294,7 +3294,7 @@ gtk_notebook_draw_focus (GtkWidget      *widget,
           area.height = page->tab_label->allocation.height + 2 * focus_width;
 
 	  gtk_paint_focus (widget->style, event->window, 
-                           GTK_WIDGET_STATE (widget), NULL, widget, "tab",
+                           gtk_widget_get_state (widget), NULL, widget, "tab",
 			   area.x, area.y, area.width, area.height);
         }
     }
@@ -5044,7 +5044,7 @@ gtk_notebook_draw_arrow (GtkNotebook      *notebook,
             state_type = GTK_STATE_PRELIGHT;
         }
       else
-        state_type = GTK_WIDGET_STATE (widget);
+        state_type = gtk_widget_get_state (widget);
 
       if (notebook->click_child == nbarrow)
         shadow_type = GTK_SHADOW_IN;
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index 37585de..c53018c 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -518,7 +518,7 @@ gtk_option_menu_paint (GtkWidget    *widget,
 	}
       
       gtk_paint_box (widget->style, widget->window,
-		     GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
+		     gtk_widget_get_state (widget), GTK_SHADOW_OUT,
 		     area, widget, "optionmenu",
 		     button_area.x, button_area.y,
 		     button_area.width, button_area.height);
@@ -532,7 +532,7 @@ gtk_option_menu_paint (GtkWidget    *widget,
 	  widget->style->xthickness;
 
       gtk_paint_tab (widget->style, widget->window,
-		     GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
+		     gtk_widget_get_state (widget), GTK_SHADOW_OUT,
 		     area, widget, "optionmenutab",
 		     tab_x,
 		     button_area.y + (button_area.height - props.indicator_size.height) / 2,
@@ -562,7 +562,7 @@ gtk_option_menu_paint (GtkWidget    *widget,
 	      button_area.height += 2 * (props.focus_width + props.focus_pad);
 	    }
 	    
-	  gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+	  gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
 			   area, widget, "button",
 			   button_area.x, 
 			   button_area.y, 
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 1e98163..a244686 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1081,7 +1081,7 @@ gtk_paned_expose (GtkWidget      *widget,
       else if (paned->handle_prelit)
 	state = GTK_STATE_PRELIGHT;
       else
-	state = GTK_WIDGET_STATE (widget);
+	state = gtk_widget_get_state (widget);
       
       gtk_paint_handle (widget->style, widget->window,
 			state, GTK_SHADOW_NONE,
diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c
index 0604bc0..e22e5ed 100644
--- a/gtk/gtkpixmap.c
+++ b/gtk/gtkpixmap.c
@@ -201,7 +201,7 @@ gtk_pixmap_expose (GtkWidget      *widget,
 	  gdk_gc_set_clip_origin (widget->style->black_gc, x, y);
 	}
 
-      if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE
+      if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE
           && pixmap->build_insensitive)
         {
 	  if (!pixmap->pixmap_insensitive)
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 45265ce..f48d220 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -653,7 +653,7 @@ gtk_radio_button_clicked (GtkButton *button)
   else
     depressed = toggle_button->active;
 
-  if (GTK_WIDGET_STATE (button) != new_state)
+  if (gtk_widget_get_state (GTK_WIDGET (button)) != new_state)
     gtk_widget_set_state (GTK_WIDGET (button), new_state);
 
   if (toggled)
@@ -727,7 +727,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
 	x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
 
-      if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
+      if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
 	{
 	  GdkRectangle restrict_area;
 	  GdkRectangle new_area;
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index ab295b9..552eac7 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1929,7 +1929,7 @@ gtk_range_expose (GtkWidget      *widget,
 	}
 
       if (sensitive && gtk_widget_has_focus (widget))
-        gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+        gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
                          &area, widget, "trough",
                          widget->allocation.x + range->range_rect.x,
                          widget->allocation.y + range->range_rect.y,
diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c
index d066775..5e16daf 100644
--- a/gtk/gtkruler.c
+++ b/gtk/gtkruler.c
@@ -784,7 +784,7 @@ gtk_ruler_real_draw_ticks (GtkRuler *ruler)
 
                   gtk_paint_layout (widget->style,
                                     ruler->backing_store,
-                                    GTK_WIDGET_STATE (widget),
+                                    gtk_widget_get_state (widget),
                                     FALSE,
                                     NULL,
                                     widget,
@@ -801,7 +801,7 @@ gtk_ruler_real_draw_ticks (GtkRuler *ruler)
 
                       gtk_paint_layout (widget->style,
                                         ruler->backing_store,
-                                        GTK_WIDGET_STATE (widget),
+                                        gtk_widget_get_state (widget),
                                         FALSE,
                                         NULL,
                                         widget,
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index a172240..b382c7d 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -197,7 +197,7 @@ gtk_separator_expose (GtkWidget      *widget,
     {
       if (wide_separators)
         gtk_paint_box (widget->style, widget->window,
-                       GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
+                       gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
                        &event->area, widget, "hseparator",
                        widget->allocation.x,
                        widget->allocation.y + (widget->allocation.height -
@@ -206,7 +206,7 @@ gtk_separator_expose (GtkWidget      *widget,
                        separator_height);
       else
         gtk_paint_hline (widget->style, widget->window,
-                         GTK_WIDGET_STATE (widget),
+                         gtk_widget_get_state (widget),
                          &event->area, widget, "hseparator",
                          widget->allocation.x,
                          widget->allocation.x + widget->allocation.width - 1,
@@ -217,7 +217,7 @@ gtk_separator_expose (GtkWidget      *widget,
     {
       if (wide_separators)
         gtk_paint_box (widget->style, widget->window,
-                       GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
+                       gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
                        &event->area, widget, "vseparator",
                        widget->allocation.x + (widget->allocation.width -
                                                separator_width) / 2,
@@ -226,7 +226,7 @@ gtk_separator_expose (GtkWidget      *widget,
                        widget->allocation.height);
       else
         gtk_paint_vline (widget->style, widget->window,
-                         GTK_WIDGET_STATE (widget),
+                         gtk_widget_get_state (widget),
                          &event->area, widget, "vseparator",
                          widget->allocation.y,
                          widget->allocation.y + widget->allocation.height - 1,
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 688093d..cebdd55 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -844,7 +844,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
 		}
 	      else
 		{
-		  state_type = GTK_WIDGET_STATE (widget);
+		  state_type = gtk_widget_get_state (widget);
 		}
 	      
 	      shadow_type = GTK_SHADOW_OUT;
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c
index 2c631a4..ff7bc0f 100644
--- a/gtk/gtkstatusbar.c
+++ b/gtk/gtkstatusbar.c
@@ -837,7 +837,7 @@ gtk_statusbar_expose_event (GtkWidget      *widget,
 
       gtk_paint_resize_grip (widget->style,
                              widget->window,
-                             GTK_WIDGET_STATE (widget),
+                             gtk_widget_get_state (widget),
                              &event->area,
                              widget,
                              "statusbar",
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 5fdbb38..5535d5a 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1278,8 +1278,8 @@ gtk_text_realize (GtkWidget *widget)
   widget->style = gtk_style_attach (widget->style, widget->window);
   
   /* Can't call gtk_style_set_background here because it's handled specially */
-  gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
-  gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+  gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
+  gdk_window_set_background (text->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
 
   if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
     text->bg_gc = create_bg_gc (text);
@@ -1316,8 +1316,8 @@ gtk_text_style_set (GtkWidget *widget,
 
   if (gtk_widget_get_realized (widget))
     {
-      gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
-      gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+      gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
+      gdk_window_set_background (text->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
       
       if (text->bg_gc)
 	{
@@ -1344,8 +1344,8 @@ gtk_text_state_changed (GtkWidget   *widget,
   
   if (gtk_widget_get_realized (widget))
     {
-      gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
-      gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+      gdk_window_set_background (widget->window, &widget->style->base[gtk_widget_get_state (widget)]);
+      gdk_window_set_background (text->text_area, &widget->style->base[gtk_widget_get_state (widget)]);
     }
 }
 
@@ -1442,7 +1442,7 @@ gtk_text_draw_focus (GtkWidget *widget)
 	  xextra -= 1;
 	  yextra -= 1;
 
-	  gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+	  gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
 			   NULL, widget, "text",
 			   0, 0,
 			   widget->allocation.width,
@@ -4695,7 +4695,7 @@ draw_bg_rect (GtkText* text, GtkPropertyMark *mark,
 			 x, y, width, height);
     }
   else if (!gdk_color_equal(MARK_CURRENT_BACK (text, mark),
-			    &GTK_WIDGET(text)->style->base[GTK_WIDGET_STATE (text)]))
+			    &GTK_WIDGET(text)->style->base[gtk_widget_get_state (GTK_WIDGET (text))]))
     {
       gdk_gc_set_foreground (text->gc, MARK_CURRENT_BACK (text, mark));
 
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 3995bd1..95e9d7d 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -242,14 +242,14 @@ _gtk_text_util_create_drag_icon (GtkWidget *widget,
                              -1);
 
   gdk_draw_rectangle (drawable,
-                      widget->style->base_gc [GTK_WIDGET_STATE (widget)],
+                      widget->style->base_gc [gtk_widget_get_state (widget)],
                       TRUE,
                       0, 0,
                       pixmap_width + 1,
                       pixmap_height + 1);
 
   gdk_draw_layout (drawable,
-                   widget->style->text_gc [GTK_WIDGET_STATE (widget)],
+                   widget->style->text_gc [gtk_widget_get_state (widget)],
                    1 + DRAG_ICON_LAYOUT_BORDER,
                    1 + DRAG_ICON_LAYOUT_BORDER,
                    layout);
@@ -357,14 +357,14 @@ _gtk_text_util_create_rich_drag_icon (GtkWidget     *widget,
                               pixmap_width  + 2, pixmap_height + 2, -1);
 
    gdk_draw_rectangle (drawable,
-                       widget->style->base_gc [GTK_WIDGET_STATE (widget)],
+                       widget->style->base_gc [gtk_widget_get_state (widget)],
                        TRUE,
                        0, 0,
                        pixmap_width + 1,
                        pixmap_height + 1);
 
    gtk_text_layout_draw (layout, widget, drawable,
-                         widget->style->text_gc [GTK_WIDGET_STATE (widget)],
+                         widget->style->text_gc [gtk_widget_get_state (widget)],
                          - (1 + DRAG_ICON_LAYOUT_BORDER),
                          - (1 + DRAG_ICON_LAYOUT_BORDER),
                          0, 0,
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 476d482..282aee2 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -3856,7 +3856,7 @@ gtk_text_view_realize (GtkWidget *widget)
   widget->style = gtk_style_attach (widget->style, widget->window);
 
   gdk_window_set_background (widget->window,
-                             &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+                             &widget->style->bg[gtk_widget_get_state (widget)]);
 
   text_window_realize (text_view->text_window, widget);
 
@@ -3942,25 +3942,25 @@ gtk_text_view_set_background (GtkTextView *text_view)
   GtkWidget *widget = GTK_WIDGET (text_view);
 
   gdk_window_set_background (widget->window,
-			     &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+			     &widget->style->bg[gtk_widget_get_state (widget)]);
   
   gdk_window_set_background (text_view->text_window->bin_window,
-			     &widget->style->base[GTK_WIDGET_STATE (widget)]);
+			     &widget->style->base[gtk_widget_get_state (widget)]);
   
   if (text_view->left_window)
     gdk_window_set_background (text_view->left_window->bin_window,
-			       &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+			       &widget->style->bg[gtk_widget_get_state (widget)]);
   if (text_view->right_window)
     gdk_window_set_background (text_view->right_window->bin_window,
-			       &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+			       &widget->style->bg[gtk_widget_get_state (widget)]);
   
   if (text_view->top_window)
     gdk_window_set_background (text_view->top_window->bin_window,
-			       &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+			       &widget->style->bg[gtk_widget_get_state (widget)]);
   
   if (text_view->bottom_window)
     gdk_window_set_background (text_view->bottom_window->bin_window,
-			       &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+			       &widget->style->bg[gtk_widget_get_state (widget)]);
 }
 
 static void
@@ -4696,7 +4696,7 @@ gtk_text_view_draw_focus (GtkWidget *widget)
     {
       if (gtk_widget_has_focus (widget) && !interior_focus)
         {          
-          gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), 
+          gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
                            NULL, widget, "textview",
                            0, 0,
                            widget->allocation.width,
@@ -8066,12 +8066,12 @@ text_window_realize (GtkTextWindow *win,
 
 
       gdk_window_set_background (win->bin_window,
-                                 &widget->style->base[GTK_WIDGET_STATE (widget)]);
+                                 &widget->style->base[gtk_widget_get_state (widget)]);
     }
   else
     {
       gdk_window_set_background (win->bin_window,
-                                 &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+                                 &widget->style->bg[gtk_widget_get_state (widget)]);
     }
 
   g_object_set_qdata (G_OBJECT (win->window),
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 35c0f10..54db87a 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -426,7 +426,7 @@ gtk_toggle_button_expose (GtkWidget      *widget,
       GtkStateType state_type;
       GtkShadowType shadow_type;
 
-      state_type = GTK_WIDGET_STATE (widget);
+      state_type = gtk_widget_get_state (widget);
       
       if (GTK_TOGGLE_BUTTON (widget)->inconsistent)
         {
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 8f065a7..a543791 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -871,7 +871,7 @@ gtk_toolbar_expose (GtkWidget      *widget,
     {
       gtk_paint_box (widget->style,
 		     widget->window,
-                     GTK_WIDGET_STATE (widget),
+                     gtk_widget_get_state (widget),
                      get_shadow_type (toolbar),
 		     &event->area, widget, "toolbar",
 		     border_width + widget->allocation.x,
@@ -4884,7 +4884,7 @@ _gtk_toolbar_paint_space_line (GtkWidget           *widget,
 
       if (wide_separators)
         gtk_paint_box (widget->style, widget->window,
-                       GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
+                       gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
                        area, widget, "vseparator",
                        allocation->x + (allocation->width - separator_width) / 2,
                        allocation->y + allocation->height * start_fraction,
@@ -4892,7 +4892,7 @@ _gtk_toolbar_paint_space_line (GtkWidget           *widget,
                        allocation->height * (end_fraction - start_fraction));
       else
         gtk_paint_vline (widget->style, widget->window,
-                         GTK_WIDGET_STATE (widget), area, widget,
+                         gtk_widget_get_state (widget), area, widget,
                          "toolbar",
                          allocation->y + allocation->height * start_fraction,
                          allocation->y + allocation->height * end_fraction,
@@ -4910,7 +4910,7 @@ _gtk_toolbar_paint_space_line (GtkWidget           *widget,
 
       if (wide_separators)
         gtk_paint_box (widget->style, widget->window,
-                       GTK_WIDGET_STATE (widget), GTK_SHADOW_ETCHED_OUT,
+                       gtk_widget_get_state (widget), GTK_SHADOW_ETCHED_OUT,
                        area, widget, "hseparator",
                        allocation->x + allocation->width * start_fraction,
                        allocation->y + (allocation->height - separator_height) / 2,
@@ -4918,7 +4918,7 @@ _gtk_toolbar_paint_space_line (GtkWidget           *widget,
                        separator_height);
       else
         gtk_paint_hline (widget->style, widget->window,
-                         GTK_WIDGET_STATE (widget), area, widget,
+                         gtk_widget_get_state (widget), area, widget,
                          "toolbar",
                          allocation->x + allocation->width * start_fraction,
                          allocation->x + allocation->width * end_fraction,
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index fed64cf..49fd86a 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -259,7 +259,7 @@ gtk_tray_icon_expose (GtkWidget      *widget,
       height = widget->allocation.height - 2 * border_width;
 
       gtk_paint_focus (widget->style, widget->window,
-                       GTK_WIDGET_STATE (widget),
+                       gtk_widget_get_state (widget),
                        &event->area, widget, "tray_icon",
                        x, y, width, height);
     }
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index 8ea6c5c..a6ca505 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -651,7 +651,7 @@ gtk_tree_item_paint (GtkWidget    *widget,
 	}
 
       if (gtk_widget_has_focus (widget))
-	gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
+	gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
 			 NULL, widget, "treeitem",
 			 0, 0,
 			 widget->allocation.width,
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index d845e14..5293b04 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4230,9 +4230,10 @@ invalidate_empty_focus (GtkTreeView *tree_view)
 static void
 draw_empty_focus (GtkTreeView *tree_view, GdkRectangle *clip_area)
 {
+  GtkWidget *widget = GTK_WIDGET (tree_view);
   gint w, h;
 
-  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
+  if (!gtk_widget_has_focus (widget))
     return;
 
   gdk_drawable_get_size (tree_view->priv->bin_window, &w, &h);
@@ -4241,11 +4242,11 @@ draw_empty_focus (GtkTreeView *tree_view, GdkRectangle *clip_area)
   h -= 2;
 
   if (w > 0 && h > 0)
-    gtk_paint_focus (GTK_WIDGET (tree_view)->style,
+    gtk_paint_focus (gtk_widget_get_style (widget),
 		     tree_view->priv->bin_window,
-		     GTK_WIDGET_STATE (tree_view),
+		     gtk_widget_get_state (widget),
 		     clip_area,
-		     GTK_WIDGET (tree_view),
+		     widget,
 		     NULL,
 		     1, 1, w, h);
 }
@@ -4869,7 +4870,7 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
 	      if (row_ending_details)
 		gtk_paint_focus (widget->style,
 			         tree_view->priv->bin_window,
-				 GTK_WIDGET_STATE (widget),
+				 gtk_widget_get_state (widget),
 				 &event->area,
 				 widget,
 				 (is_first
@@ -4882,7 +4883,7 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
 	      else
 		gtk_paint_focus (widget->style,
 			         tree_view->priv->bin_window,
-				 GTK_WIDGET_STATE (widget),
+				 gtk_widget_get_state (widget),
 				 &event->area,
 				 widget,
 				 "treeview-drop-indicator",
@@ -4896,7 +4897,7 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
           if (highlight_y >= 0)
             {
               gdk_draw_line (event->window,
-                             widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+                             widget->style->fg_gc[gtk_widget_get_state (widget)],
                              rtl ? highlight_x + expander_cell_width : highlight_x,
                              highlight_y,
                              rtl ? 0 : bin_window_width,
@@ -9513,7 +9514,9 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
   gint expander_size;
   GtkExpanderStyle expander_style;
 
-  gtk_widget_style_get (GTK_WIDGET (tree_view),
+  widget = GTK_WIDGET (tree_view);
+
+  gtk_widget_style_get (widget,
 			"vertical-separator", &vertical_separator,
 			NULL);
   expander_size = tree_view->priv->expander_size - EXPANDER_EXTRA_PADDING;
@@ -9521,8 +9524,6 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
   if (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT))
     return;
 
-  widget = GTK_WIDGET (tree_view);
-
   gtk_tree_view_get_arrow_xrange (tree_view, tree, &x_offset, &x2);
 
   area.x = x_offset;
@@ -9530,7 +9531,7 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
   area.width = expander_size + 2;
   area.height = MAX (CELL_HEIGHT (node, vertical_separator), (expander_size - vertical_separator));
 
-  if (GTK_WIDGET_STATE (tree_view) == GTK_STATE_INSENSITIVE)
+  if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
     {
       state = GTK_STATE_INSENSITIVE;
     }
@@ -13809,7 +13810,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView  *tree_view,
   expose_area.height = background_area.height + 2;
 
   gdk_draw_rectangle (drawable,
-                      widget->style->base_gc [GTK_WIDGET_STATE (widget)],
+                      widget->style->base_gc [gtk_widget_get_state (widget)],
                       TRUE,
                       0, 0,
                       bin_window_width + 2,
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 8744bcd..836eee0 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -3519,7 +3519,7 @@ _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn  *tree_column,
 #if 0
       gtk_paint_focus (tree_column->tree_view->style,
 		       window,
-		       GTK_WIDGET_STATE (tree_column->tree_view),
+		       gtk_widget_get_state (tree_column->tree_view),
 		       NULL,
 		       tree_column->tree_view,
 		       "treeview",
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 13119c6..80f20f1 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5784,7 +5784,7 @@ gtk_widget_set_state (GtkWidget           *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (state == GTK_WIDGET_STATE (widget))
+  if (state == gtk_widget_get_state (widget))
     return;
 
   if (state == GTK_STATE_INSENSITIVE)
@@ -6246,7 +6246,7 @@ gtk_widget_set_sensitive (GtkWidget *widget,
   else
     {
       GTK_OBJECT_FLAGS (widget) &= ~(GTK_SENSITIVE);
-      data.state = GTK_WIDGET_STATE (widget);
+      data.state = gtk_widget_get_state (widget);
     }
   data.state_restoration = TRUE;
   data.use_forall = TRUE;
@@ -6343,10 +6343,10 @@ gtk_widget_set_parent (GtkWidget *widget,
   g_object_ref_sink (widget);
   widget->parent = parent;
 
-  if (GTK_WIDGET_STATE (parent) != GTK_STATE_NORMAL)
-    data.state = GTK_WIDGET_STATE (parent);
+  if (gtk_widget_get_state (parent) != GTK_STATE_NORMAL)
+    data.state = gtk_widget_get_state (parent);
   else
-    data.state = GTK_WIDGET_STATE (widget);
+    data.state = gtk_widget_get_state (widget);
   data.state_restoration = FALSE;
   data.parent_sensitive = (gtk_widget_is_sensitive (parent) != FALSE);
   data.use_forall = gtk_widget_is_sensitive (parent) != gtk_widget_is_sensitive (widget);
@@ -7354,7 +7354,7 @@ gtk_widget_render_icon (GtkWidget      *widget,
   retval = gtk_icon_set_render_icon (icon_set,
                                      widget->style,
                                      gtk_widget_get_direction (widget),
-                                     GTK_WIDGET_STATE (widget),
+                                     gtk_widget_get_state (widget),
                                      size,
                                      widget,
                                      detail);
@@ -9174,7 +9174,7 @@ static void
 gtk_widget_propagate_state (GtkWidget           *widget,
 			    GtkStateData        *data)
 {
-  guint8 old_state = GTK_WIDGET_STATE (widget);
+  guint8 old_state = gtk_widget_get_state (widget);
   guint8 old_saved_state = widget->saved_state;
 
   /* don't call this function with state==GTK_STATE_INSENSITIVE,
@@ -9190,9 +9190,9 @@ gtk_widget_propagate_state (GtkWidget           *widget,
   if (gtk_widget_is_sensitive (widget))
     {
       if (data->state_restoration)
-        GTK_WIDGET_STATE (widget) = widget->saved_state;
+        widget->state = widget->saved_state;
       else
-        GTK_WIDGET_STATE (widget) = data->state;
+        widget->state = data->state;
     }
   else
     {
@@ -9201,9 +9201,9 @@ gtk_widget_propagate_state (GtkWidget           *widget,
 	  if (data->state != GTK_STATE_INSENSITIVE)
 	    widget->saved_state = data->state;
 	}
-      else if (GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE)
-	widget->saved_state = GTK_WIDGET_STATE (widget);
-      GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE;
+      else if (gtk_widget_get_state (widget) != GTK_STATE_INSENSITIVE)
+	widget->saved_state = gtk_widget_get_state (widget);
+      widget->state = GTK_STATE_INSENSITIVE;
     }
 
   if (gtk_widget_is_focus (widget) && !gtk_widget_is_sensitive (widget))
@@ -9215,7 +9215,7 @@ gtk_widget_propagate_state (GtkWidget           *widget,
 	gtk_window_set_focus (GTK_WINDOW (window), NULL);
     }
 
-  if (old_state != GTK_WIDGET_STATE (widget) ||
+  if (old_state != gtk_widget_get_state (widget) ||
       old_saved_state != widget->saved_state)
     {
       g_object_ref (widget);
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index c766bde..8de14d3 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -152,6 +152,7 @@ typedef enum
 #define GTK_WIDGET_TYPE(wid)		  (GTK_OBJECT_TYPE (wid))
 #endif
 
+#ifndef GTK_DISABLE_DEPRECATED
 /**
  * GTK_WIDGET_STATE:
  * @wid: a #GtkWidget.
@@ -161,7 +162,7 @@ typedef enum
  * Deprecated: 2.20: Use gtk_widget_get_state() instead.
  */
 #define GTK_WIDGET_STATE(wid)		  (GTK_WIDGET (wid)->state)
-/* FIXME: Deprecating GTK_WIDGET_STATE requires fixing GTK internals. */
+#endif
 
 #ifndef GTK_DISABLE_DEPRECATED
 /**
diff --git a/modules/other/gail/gailbutton.c b/modules/other/gail/gailbutton.c
index e5f17e6..9b579e0 100644
--- a/modules/other/gail/gailbutton.c
+++ b/modules/other/gail/gailbutton.c
@@ -881,7 +881,7 @@ gail_button_ref_state_set (AtkObject *obj)
   if (widget == NULL)
     return state_set;
 
-  if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
+  if (gtk_widget_get_state (widget) == GTK_STATE_ACTIVE)
     atk_state_set_add_state (state_set, ATK_STATE_ARMED);
 
   if (!gtk_widget_get_can_focus (widget))
@@ -902,7 +902,7 @@ gail_button_pressed_enter_handler (GtkWidget       *widget)
 {
   AtkObject *accessible;
 
-  if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
+  if (gtk_widget_get_state (widget) == GTK_STATE_ACTIVE)
     {
       accessible = gtk_widget_get_accessible (widget);
       atk_object_notify_state_change (accessible, ATK_STATE_ARMED, TRUE);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index b4f8589..ba57dc4 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -3529,7 +3529,7 @@ grippy_expose (GtkWidget *area, GdkEventExpose *event, GdkWindowEdge edge)
 {
   gtk_paint_resize_grip (area->style,
 			 area->window,
-			 GTK_WIDGET_STATE (area),
+			 gtk_widget_get_state (area),
 			 &event->area,
 			 area,
 			 "statusbar",
diff --git a/tests/testinput.c b/tests/testinput.c
index de65a4c..b1df354 100644
--- a/tests/testinput.c
+++ b/tests/testinput.c
@@ -56,7 +56,7 @@ update_cursor (GtkWidget *widget,  gdouble x, gdouble y)
 			     x != cursor_x || y != cursor_y))
 	{
 	  gdk_draw_drawable (widget->window,
-			     widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+			     widget->style->fg_gc[gtk_widget_get_state (widget)],
 			     pixmap,
 			     cursor_x - 5, cursor_y - 5,
 			     cursor_x - 5, cursor_y - 5,
@@ -103,7 +103,7 @@ static gint
 expose_event (GtkWidget *widget, GdkEventExpose *event)
 {
   gdk_draw_drawable (widget->window,
-		     widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+		     widget->style->fg_gc[gtk_widget_get_state (widget)],
 		     pixmap,
 		     event->area.x, event->area.y,
 		     event->area.x, event->area.y,
@@ -124,7 +124,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
   switch (source)
     {
     case GDK_SOURCE_MOUSE:
-      gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget->style->dark_gc[gtk_widget_get_state (widget)];
       break;
     case GDK_SOURCE_PEN:
       gc = widget->style->black_gc;
@@ -133,7 +133,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
       gc = widget->style->white_gc;
       break;
     default:
-      gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
+      gc = widget->style->light_gc[gtk_widget_get_state (widget)];
     }
 
   update_rect.x = x - 10 * pressure;
diff --git a/tests/testtext.c b/tests/testtext.c
index 36247df..e717c4e 100644
--- a/tests/testtext.c
+++ b/tests/testtext.c
@@ -2864,7 +2864,7 @@ line_numbers_expose (GtkWidget      *widget,
 
       gtk_paint_layout (widget->style,
                         target,
-                        GTK_WIDGET_STATE (widget),
+                        gtk_widget_get_state (widget),
                         FALSE,
                         NULL,
                         widget,



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