[gtk+] Deprecate widget flag: GTK_WIDGET_HAS_FOCUS



commit 4232115e22c8ea41d6a3faf89bcaadfc9933d5e3
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Mar 1 04:21:41 2010 +0100

    Deprecate widget flag: GTK_WIDGET_HAS_FOCUS
    
    Use gtk_widget_has_focus() instead
    
    https://bugzilla.gnome.org/show_bug.cgi?id=69872

 gtk/gtkbutton.c                        |    6 ++--
 gtk/gtkcalendar.c                      |   16 +++++-----
 gtk/gtkcellrendererpixbuf.c            |    2 +-
 gtk/gtkcellrendererspinner.c           |    2 +-
 gtk/gtkcellrenderertext.c              |    4 +-
 gtk/gtkcellrenderertoggle.c            |    2 +-
 gtk/gtkcheckbutton.c                   |    2 +-
 gtk/gtkclist.c                         |   18 +++++-----
 gtk/gtkcolorsel.c                      |    2 +-
 gtk/gtkcombo.c                         |    4 +-
 gtk/gtkcombobox.c                      |    6 ++--
 gtk/gtkcontainer.c                     |    6 ++--
 gtk/gtkctree.c                         |    4 +-
 gtk/gtkentry.c                         |   53 ++++++++++++++++++-------------
 gtk/gtkentrycompletion.c               |    2 +-
 gtk/gtkexpander.c                      |    2 +-
 gtk/gtkfilechooserdefault.c            |    2 +-
 gtk/gtkfilechooserentry.c              |    2 +-
 gtk/gtkhsv.c                           |    6 ++--
 gtk/gtkiconview.c                      |   18 +++++-----
 gtk/gtklabel.c                         |    8 ++--
 gtk/gtklinkbutton.c                    |    2 +-
 gtk/gtklist.c                          |   10 +++---
 gtk/gtklistitem.c                      |    4 +-
 gtk/gtknotebook.c                      |    4 +-
 gtk/gtkoptionmenu.c                    |    4 +-
 gtk/gtkrange.c                         |    5 +--
 gtk/gtksocket.c                        |    2 +-
 gtk/gtkspinbutton.c                    |    6 ++--
 gtk/gtkstyle.c                         |    8 ++--
 gtk/gtktext.c                          |    6 ++--
 gtk/gtktextdisplay.c                   |   12 +++---
 gtk/gtktextview.c                      |   18 +++++-----
 gtk/gtktrayicon-x11.c                  |    2 +-
 gtk/gtktreeitem.c                      |    8 ++--
 gtk/gtktreeview.c                      |   50 +++++++++++++++--------------
 gtk/gtktreeviewcolumn.c                |    2 +-
 gtk/gtkwidget.c                        |    6 ++--
 gtk/gtkwidget.h                        |    4 ++
 gtk/gtkwindow.c                        |    8 ++--
 gtk/tests/builder.c                    |    2 +-
 gtk/tests/testing.c                    |    2 +-
 modules/engines/ms-windows/msw_style.c |    4 +-
 modules/other/gail/gail.c              |    2 +-
 modules/other/gail/gailtreeview.c      |    2 +-
 modules/other/gail/gailwidget.c        |    2 +-
 46 files changed, 178 insertions(+), 164 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 6862b18..860d91a 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1510,7 +1510,7 @@ _gtk_button_paint (GtkButton          *button,
 	  height -= default_outside_border.top + default_outside_border.bottom;
 	}
        
-      if (!interior_focus && GTK_WIDGET_HAS_FOCUS (widget))
+      if (!interior_focus && gtk_widget_has_focus (widget))
 	{
 	  x += focus_width + focus_pad;
 	  y += focus_width + focus_pad;
@@ -1525,7 +1525,7 @@ _gtk_button_paint (GtkButton          *button,
 		       shadow_type, area, widget, "button",
 		       x, y, width, height);
        
-      if (GTK_WIDGET_HAS_FOCUS (widget))
+      if (gtk_widget_has_focus (widget))
 	{
 	  gint child_displacement_x;
 	  gint child_displacement_y;
@@ -1594,7 +1594,7 @@ gtk_button_button_press (GtkWidget      *widget,
     {
       button = GTK_BUTTON (widget);
 
-      if (button->focus_on_click && !GTK_WIDGET_HAS_FOCUS (widget))
+      if (button->focus_on_click && !gtk_widget_has_focus (widget))
 	gtk_widget_grab_focus (widget);
 
       if (event->button == 1)
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index c8d6c67..3401197 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -188,8 +188,8 @@ dates_difference(guint year1, guint mm1, guint dd1,
 /* 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 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 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)])
@@ -2573,13 +2573,13 @@ calendar_paint_day (GtkCalendar *calendar,
       pango_cairo_show_layout (cr, layout);
     }
 
-  if (GTK_WIDGET_HAS_FOCUS (calendar) 
+  if (gtk_widget_has_focus (widget)
       && calendar->focus_row == row && calendar->focus_col == col)
     {
       GtkStateType state;
 
       if (calendar->selected_day == day)
-	state = GTK_WIDGET_HAS_FOCUS (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
+	state = gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
       else
 	state = GTK_STATE_NORMAL;
       
@@ -2823,7 +2823,7 @@ calendar_main_button_press (GtkCalendar	   *calendar,
       else if (day_month == MONTH_NEXT)
 	calendar_set_month_next (calendar);
       
-      if (!GTK_WIDGET_HAS_FOCUS (widget))
+      if (!gtk_widget_has_focus (widget))
 	gtk_widget_grab_focus (widget);
 	  
       if (event->button == 1) 
@@ -2856,7 +2856,7 @@ gtk_calendar_button_press (GtkWidget	  *widget,
   if (event->window == priv->main_win)
     calendar_main_button_press (calendar, event);
 
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   for (arrow = ARROW_YEAR_LEFT; arrow <= ARROW_MONTH_RIGHT; arrow++)
@@ -3048,13 +3048,13 @@ gtk_calendar_scroll (GtkWidget      *widget,
 
   if (event->direction == GDK_SCROLL_UP) 
     {
-      if (!GTK_WIDGET_HAS_FOCUS (widget))
+      if (!gtk_widget_has_focus (widget))
 	gtk_widget_grab_focus (widget);
       calendar_set_month_prev (calendar);
     }
   else if (event->direction == GDK_SCROLL_DOWN) 
     {
-      if (!GTK_WIDGET_HAS_FOCUS (widget))
+      if (!gtk_widget_has_focus (widget))
 	gtk_widget_grab_focus (widget);
       calendar_set_month_next (calendar);
     }
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index c0ec609..902b0d4 100644
--- a/gtk/gtkcellrendererpixbuf.c
+++ b/gtk/gtkcellrendererpixbuf.c
@@ -747,7 +747,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
 
       if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
 	{
-	  if (GTK_WIDGET_HAS_FOCUS (widget))
+	  if (gtk_widget_has_focus (widget))
 	    state = GTK_STATE_SELECTED;
 	  else
 	    state = GTK_STATE_ACTIVE;
diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c
index 2524aca..fe1d8d9 100644
--- a/gtk/gtkcellrendererspinner.c
+++ b/gtk/gtkcellrendererspinner.c
@@ -368,7 +368,7 @@ gtk_cell_renderer_spinner_render (GtkCellRenderer *cellr,
     {
       if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
         {
-          if (GTK_WIDGET_HAS_FOCUS (widget))
+          if (gtk_widget_has_focus (widget))
             state = GTK_STATE_SELECTED;
           else
             state = GTK_STATE_ACTIVE;
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index 2ab0f14..ca5588d 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -1636,7 +1636,7 @@ gtk_cell_renderer_text_render (GtkCellRenderer      *cell,
     }
   else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
     {
-      if (GTK_WIDGET_HAS_FOCUS (widget))
+      if (gtk_widget_has_focus (widget))
 	state = GTK_STATE_SELECTED;
       else
 	state = GTK_STATE_ACTIVE;
@@ -1749,7 +1749,7 @@ popdown_timeout (gpointer data)
 
   priv->entry_menu_popdown_timeout = 0;
 
-  if (!GTK_WIDGET_HAS_FOCUS (priv->entry))
+  if (!gtk_widget_has_focus (priv->entry))
     gtk_cell_renderer_text_editing_done (GTK_CELL_EDITABLE (priv->entry), data);
 
   return FALSE;
diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c
index d097bb0..7d3eb88 100644
--- a/gtk/gtkcellrenderertoggle.c
+++ b/gtk/gtkcellrenderertoggle.c
@@ -355,7 +355,7 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer      *cell,
     }
   else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
     {
-      if (GTK_WIDGET_HAS_FOCUS (widget))
+      if (gtk_widget_has_focus (widget))
 	state = GTK_STATE_SELECTED;
       else
 	state = GTK_STATE_ACTIVE;
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 80e2f69..a9e34b2 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -149,7 +149,7 @@ gtk_check_button_paint (GtkWidget    *widget,
       gtk_check_button_draw_indicator (check_button, area);
       
       border_width = GTK_CONTAINER (widget)->border_width;
-      if (GTK_WIDGET_HAS_FOCUS (widget))
+      if (gtk_widget_has_focus (widget))
 	{
 	  GtkWidget *child = GTK_BIN (widget)->child;
 	  
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 2e8c14e..d66bd7e 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -3937,7 +3937,7 @@ real_undo_selection (GtkCList *clist)
 		       GPOINTER_TO_INT (work->data), -1, NULL);
     }
 
-  if (GTK_WIDGET_HAS_FOCUS(clist) && clist->focus_row != clist->undo_anchor)
+  if (gtk_widget_has_focus (GTK_WIDGET (clist)) && clist->focus_row != clist->undo_anchor)
     {
       gtk_clist_draw_focus (GTK_WIDGET (clist));
       clist->focus_row = clist->undo_anchor;
@@ -4279,7 +4279,7 @@ end_selection (GtkCList *clist)
   g_return_if_fail (GTK_IS_CLIST (clist));
 
   if (gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist))) &&
-      GTK_WIDGET_HAS_FOCUS (clist))
+      gtk_widget_has_focus (GTK_WIDGET (clist)))
     return;
 
   GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
@@ -4923,7 +4923,7 @@ gtk_clist_button_press (GtkWidget      *widget,
 	      if (GTK_CLIST_ADD_MODE(clist))
 		{
 		  GTK_CLIST_UNSET_FLAG (clist, CLIST_ADD_MODE);
-		  if (GTK_WIDGET_HAS_FOCUS(widget))
+		  if (gtk_widget_has_focus (widget))
 		    {
 		      gtk_clist_draw_focus (widget);
 		      gdk_gc_set_line_attributes (clist->xor_gc, 1,
@@ -4940,7 +4940,7 @@ gtk_clist_button_press (GtkWidget      *widget,
 		}
 	      else if (row != clist->focus_row)
 		{
-		  if (GTK_WIDGET_HAS_FOCUS(widget))
+		  if (gtk_widget_has_focus (widget))
 		    {
 		      gtk_clist_draw_focus (widget);
 		      clist->focus_row = row;
@@ -4951,7 +4951,7 @@ gtk_clist_button_press (GtkWidget      *widget,
 		}
 	    }
 
-	  if (!GTK_WIDGET_HAS_FOCUS(widget))
+	  if (!gtk_widget_has_focus (widget))
 	    gtk_widget_grab_focus (widget);
 
 	  if (button_actions & GTK_BUTTON_SELECTS)
@@ -5058,7 +5058,7 @@ gtk_clist_button_press (GtkWidget      *widget,
 	if (drag_data)
 	  gtk_signal_handler_block_by_data (GTK_OBJECT (clist), drag_data);
 
-	if (!GTK_WIDGET_HAS_FOCUS(widget))
+	if (!gtk_widget_has_focus (widget))
 	  gtk_widget_grab_focus (widget);
 
 	clist->drag_pos = i;
@@ -5867,7 +5867,7 @@ draw_row (GtkCList     *clist,
 
   /* draw focus rectangle */
   if (clist->focus_row == row &&
-      GTK_WIDGET_CAN_FOCUS (widget) && GTK_WIDGET_HAS_FOCUS(widget))
+      GTK_WIDGET_CAN_FOCUS (widget) && gtk_widget_has_focus (widget))
     {
       if (!area)
 	gdk_draw_rectangle (clist->clist_window, clist->xor_gc, FALSE,
@@ -6236,7 +6236,7 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
 
   if (GTK_WIDGET_DRAWABLE (clist))
     {
-      if (GTK_WIDGET_CAN_FOCUS(clist) && GTK_WIDGET_HAS_FOCUS(clist) &&
+      if (GTK_WIDGET_CAN_FOCUS(clist) && gtk_widget_has_focus (GTK_WIDGET (clist)) &&
           !container->focus_child && GTK_CLIST_ADD_MODE(clist))
         {
           y = ROW_TOP_YPIXEL (clist, clist->focus_row);
@@ -6249,7 +6249,7 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
       gdk_window_scroll (clist->clist_window, dx, 0);
       gdk_window_process_updates (clist->clist_window, FALSE);
 
-      if (GTK_WIDGET_CAN_FOCUS(clist) && GTK_WIDGET_HAS_FOCUS(clist) &&
+      if (GTK_WIDGET_CAN_FOCUS(clist) && gtk_widget_has_focus (GTK_WIDGET (clist)) &&
           !container->focus_child)
         {
           if (GTK_CLIST_ADD_MODE(clist))
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index 413b4cf..80368a3 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -1049,7 +1049,7 @@ palette_paint (GtkWidget    *drawing_area,
   gdk_cairo_rectangle (cr, area);
   cairo_fill (cr);
   
-  if (GTK_WIDGET_HAS_FOCUS (drawing_area))
+  if (gtk_widget_has_focus (drawing_area))
     {
       set_focus_line_attributes (drawing_area, cr, &focus_width);
 
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index 73c9990..7c7e9b4 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -637,7 +637,7 @@ gtk_combo_activate (GtkWidget        *widget,
   popup_grab_on_window (combo->popwin->window,
 			gtk_get_current_event_time ());
 
-  if (!GTK_WIDGET_HAS_FOCUS (combo->entry))
+  if (!gtk_widget_has_focus (combo->entry))
     gtk_widget_grab_focus (combo->entry);
 
   gtk_grab_add (combo->popwin);
@@ -648,7 +648,7 @@ gtk_combo_popup_button_press (GtkWidget        *button,
 			      GdkEventButton   *event,
 			      GtkCombo         *combo)
 {
-  if (!GTK_WIDGET_HAS_FOCUS (combo->entry))
+  if (!gtk_widget_has_focus (combo->entry))
     gtk_widget_grab_focus (combo->entry);
 
   if (event->button != 1)
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index f4427bf..5eb0737 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1962,7 +1962,7 @@ gtk_combo_box_real_popup (GtkComboBox *combo_box)
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button),
                                 TRUE);
 
-  if (!GTK_WIDGET_HAS_FOCUS (priv->tree_view))
+  if (!gtk_widget_has_focus (priv->tree_view))
     gtk_widget_grab_focus (priv->tree_view);
 
   if (!popup_grab_on_window (priv->popup_window->window,
@@ -3168,7 +3168,7 @@ gtk_combo_box_menu_button_press (GtkWidget      *widget,
       event->type == GDK_BUTTON_PRESS && event->button == 1)
     {
       if (priv->focus_on_click && 
-	  !GTK_WIDGET_HAS_FOCUS (priv->button))
+	  !gtk_widget_has_focus (priv->button))
 	gtk_widget_grab_focus (priv->button);
 
       gtk_combo_box_menu_popup (combo_box, event->button, event->time);
@@ -3890,7 +3890,7 @@ gtk_combo_box_list_button_pressed (GtkWidget      *widget,
     return FALSE;
 
   if (priv->focus_on_click && 
-      !GTK_WIDGET_HAS_FOCUS (priv->button))
+      !gtk_widget_has_focus (priv->button))
     gtk_widget_grab_focus (priv->button);
 
   gtk_combo_box_popup (combo_box);
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index f66b05c..3f54017 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1811,11 +1811,11 @@ gtk_container_focus (GtkWidget        *widget,
 
   return_val = FALSE;
 
-  if (gtk_widget_get_can_focus (GTK_WIDGET (container)))
+  if (gtk_widget_get_can_focus (widget))
     {
-      if (!GTK_WIDGET_HAS_FOCUS (container))
+      if (!gtk_widget_has_focus (widget))
 	{
-	  gtk_widget_grab_focus (GTK_WIDGET (container));
+	  gtk_widget_grab_focus (widget);
 	  return_val = TRUE;
 	}
     }
diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c
index 48511e3..7605b9e 100644
--- a/gtk/gtkctree.c
+++ b/gtk/gtkctree.c
@@ -2002,7 +2002,7 @@ draw_row (GtkCList     *clist,
 
   /* draw focus rectangle */
   if (clist->focus_row == row &&
-      GTK_WIDGET_CAN_FOCUS (widget) && GTK_WIDGET_HAS_FOCUS (widget))
+      GTK_WIDGET_CAN_FOCUS (widget) && gtk_widget_has_focus (widget))
     {
       if (!area)
 	gdk_draw_rectangle (clist->clist_window, clist->xor_gc, FALSE,
@@ -5760,7 +5760,7 @@ real_undo_selection (GtkCList *clist)
     if (GTK_CTREE_ROW (work->data)->row.selectable)
       gtk_ctree_unselect (ctree, GTK_CTREE_NODE (work->data));
 
-  if (GTK_WIDGET_HAS_FOCUS (clist) && clist->focus_row != clist->undo_anchor)
+  if (gtk_widget_has_focus (GTK_WIDGET (clist)) && clist->focus_row != clist->undo_anchor)
     {
       clist->focus_row = clist->undo_anchor;
       gtk_widget_queue_draw (GTK_WIDGET (clist));
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 2d53876..9d0df4d 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -1809,6 +1809,7 @@ gtk_entry_set_property (GObject         *object,
 {
   GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (object);
   GtkEntry *entry = GTK_ENTRY (object);
+  GtkWidget *widget;
 
   switch (prop_id)
     {
@@ -1822,10 +1823,11 @@ gtk_entry_set_property (GObject         *object,
 
       	if (new_value != entry->editable)
 	  {
+            widget = GTK_WIDGET (entry);
 	    if (!new_value)
 	      {
 		_gtk_entry_reset_im_context (entry);
-		if (GTK_WIDGET_HAS_FOCUS (entry))
+		if (gtk_widget_has_focus (widget))
 		  gtk_im_context_focus_out (entry->im_context);
 
 		entry->preedit_length = 0;
@@ -1834,7 +1836,7 @@ gtk_entry_set_property (GObject         *object,
 
 	    entry->editable = new_value;
 
-	    if (new_value && GTK_WIDGET_HAS_FOCUS (entry))
+	    if (new_value && gtk_widget_has_focus (widget))
 	      gtk_im_context_focus_in (entry->im_context);
 	    
 	    gtk_entry_queue_draw (entry);
@@ -2365,7 +2367,7 @@ get_icon_allocations (GtkEntry      *entry,
 
   get_text_area_size (entry, &x, &y, &width, &height);
 
-  if (GTK_WIDGET_HAS_FOCUS (entry) && !priv->interior_focus)
+  if (gtk_widget_has_focus (GTK_WIDGET (entry)) && !priv->interior_focus)
     y += priv->focus_width;
 
   primary->y = y;
@@ -2944,6 +2946,7 @@ gtk_entry_size_request (GtkWidget      *widget,
 static void
 place_windows (GtkEntry *entry)
 {
+  GtkWidget *widget = GTK_WIDGET (entry);
   GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
   gint x, y, width, height;
   GtkAllocation primary;
@@ -2953,10 +2956,10 @@ place_windows (GtkEntry *entry)
   get_text_area_size (entry, &x, &y, &width, &height);
   get_icon_allocations (entry, &primary, &secondary);
 
-  if (GTK_WIDGET_HAS_FOCUS (entry) && !priv->interior_focus)
+  if (gtk_widget_has_focus (widget) && !priv->interior_focus)
     y += priv->focus_width;
 
-  if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
+  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
     x += secondary.width;
   else
     x += primary.width;
@@ -2972,7 +2975,7 @@ place_windows (GtkEntry *entry)
                             secondary.x, secondary.y,
                             secondary.width, secondary.height);
 
-  gdk_window_move_resize (GTK_ENTRY (entry)->text_area, x, y, width, height);
+  gdk_window_move_resize (entry->text_area, x, y, width, height);
 }
 
 static void
@@ -2996,7 +2999,7 @@ gtk_entry_get_text_area_size (GtkEntry *entry,
   else
     frame_height = requisition.height;
 
-  if (GTK_WIDGET_HAS_FOCUS (widget) && !priv->interior_focus)
+  if (gtk_widget_has_focus (widget) && !priv->interior_focus)
     frame_height -= 2 * priv->focus_width;
 
   if (x)
@@ -3291,7 +3294,7 @@ gtk_entry_draw_frame (GtkWidget      *widget,
       width += xborder * 2;
     }
 
-  if (GTK_WIDGET_HAS_FOCUS (widget) && !priv->interior_focus)
+  if (gtk_widget_has_focus (widget) && !priv->interior_focus)
     {
       x += priv->focus_width;
       y += priv->focus_width;
@@ -3301,7 +3304,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) ?
+      state = gtk_widget_has_focus (widget) ?
         GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
   else
       state = GTK_STATE_NORMAL;
@@ -3313,7 +3316,7 @@ gtk_entry_draw_frame (GtkWidget      *widget,
 
   gtk_entry_draw_progress (widget, event);
 
-  if (GTK_WIDGET_HAS_FOCUS (widget) && !priv->interior_focus)
+  if (gtk_widget_has_focus (widget) && !priv->interior_focus)
     {
       x -= priv->focus_width;
       y -= priv->focus_width;
@@ -3368,7 +3371,7 @@ get_progress_area (GtkWidget *widget,
   *width -= progress_border.left + progress_border.right;
   *height -= progress_border.top + progress_border.bottom;
 
-  if (GTK_WIDGET_HAS_FOCUS (widget) && !private->interior_focus)
+  if (gtk_widget_has_focus (widget) && !private->interior_focus)
     {
       *x += private->focus_width;
       *y += private->focus_width;
@@ -3451,7 +3454,7 @@ gtk_entry_expose (GtkWidget      *widget,
 
   gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
   if (state_hint)
-    state = GTK_WIDGET_HAS_FOCUS (widget) ?
+    state = gtk_widget_has_focus (widget) ?
       GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
   else
     state = GTK_WIDGET_STATE(widget);
@@ -3480,7 +3483,7 @@ gtk_entry_expose (GtkWidget      *widget,
 
       /* When no text is being displayed at all, don't show the cursor */
       if (gtk_entry_get_display_mode (entry) != DISPLAY_BLANK &&
-	  GTK_WIDGET_HAS_FOCUS (widget) &&
+	  gtk_widget_has_focus (widget) &&
 	  entry->selection_bound == entry->current_pos && entry->cursor_visible) 
         gtk_entry_draw_cursor (GTK_ENTRY (widget), CURSOR_STANDARD);
     }
@@ -3682,7 +3685,7 @@ gtk_entry_button_press (GtkWidget      *widget,
 
   entry->button = event->button;
   
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     {
       entry->in_click = TRUE;
       gtk_widget_grab_focus (widget);
@@ -5407,7 +5410,7 @@ gtk_entry_create_layout (GtkEntry *entry,
 
       if (pango_dir == PANGO_DIRECTION_NEUTRAL)
         {
-          if (GTK_WIDGET_HAS_FOCUS (widget))
+          if (gtk_widget_has_focus (widget))
 	    {
 	      GdkDisplay *display = gtk_widget_get_display (widget);
 	      GdkKeymap *keymap = gdk_keymap_get_for_display (display);
@@ -5535,7 +5538,7 @@ draw_text_with_color (GtkEntry *entry, cairo_t *cr, GdkColor *default_color)
       pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
       gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
 
-      if (GTK_WIDGET_HAS_FOCUS (entry))
+      if (gtk_widget_has_focus (widget))
         {
           selection_color = &widget->style->base [GTK_STATE_SELECTED];
           text_color = &widget->style->text [GTK_STATE_SELECTED];
@@ -9049,7 +9052,7 @@ gtk_entry_drag_data_delete (GtkWidget      *widget,
 static gboolean
 cursor_blinks (GtkEntry *entry)
 {
-  if (GTK_WIDGET_HAS_FOCUS (entry) &&
+  if (gtk_widget_has_focus (GTK_WIDGET (entry)) &&
       entry->editable &&
       entry->selection_bound == entry->current_pos)
     {
@@ -9090,24 +9093,30 @@ get_cursor_blink_timeout (GtkEntry *entry)
 static void
 show_cursor (GtkEntry *entry)
 {
+  GtkWidget *widget;
+
   if (!entry->cursor_visible)
     {
       entry->cursor_visible = TRUE;
 
-      if (GTK_WIDGET_HAS_FOCUS (entry) && entry->selection_bound == entry->current_pos)
-	gtk_widget_queue_draw (GTK_WIDGET (entry));
+      widget = GTK_WIDGET (entry);
+      if (gtk_widget_has_focus (widget) && entry->selection_bound == entry->current_pos)
+	gtk_widget_queue_draw (widget);
     }
 }
 
 static void
 hide_cursor (GtkEntry *entry)
 {
+  GtkWidget *widget;
+
   if (entry->cursor_visible)
     {
       entry->cursor_visible = FALSE;
 
-      if (GTK_WIDGET_HAS_FOCUS (entry) && entry->selection_bound == entry->current_pos)
-	gtk_widget_queue_draw (GTK_WIDGET (entry));
+      widget = GTK_WIDGET (entry);
+      if (gtk_widget_has_focus (widget) && entry->selection_bound == entry->current_pos)
+	gtk_widget_queue_draw (widget);
     }
 }
 
@@ -9124,7 +9133,7 @@ blink_cb (gpointer data)
   entry = GTK_ENTRY (data);
   priv = GTK_ENTRY_GET_PRIVATE (entry);
  
-  if (!GTK_WIDGET_HAS_FOCUS (entry))
+  if (!gtk_widget_has_focus (GTK_WIDGET (entry)))
     {
       g_warning ("GtkEntry - did not receive focus-out-event. If you\n"
 		 "connect a handler to this signal, it must return\n"
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index bb5dda8..dbb2e72 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -1480,7 +1480,7 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
   if (!GTK_WIDGET_MAPPED (completion->priv->entry))
     return;
 
-  if (!GTK_WIDGET_HAS_FOCUS (completion->priv->entry))
+  if (!gtk_widget_has_focus (completion->priv->entry))
     return;
 
   completion->priv->ignore_enter = TRUE;
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 6ed4975..e96635b 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -903,7 +903,7 @@ gtk_expander_expose (GtkWidget      *widget,
 
       gtk_expander_paint (expander);
 
-      if (GTK_WIDGET_HAS_FOCUS (expander))
+      if (gtk_widget_has_focus (widget))
 	gtk_expander_paint_focus (expander, &event->area);
 
       GTK_WIDGET_CLASS (gtk_expander_parent_class)->expose_event (widget, event);
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index f97c01e..b54865e 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -5051,7 +5051,7 @@ location_toggle_popup_handler (GtkFileChooserDefault *impl)
     }
   else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
     {
-      if (GTK_WIDGET_HAS_FOCUS (impl->location_entry))
+      if (gtk_widget_has_focus (impl->location_entry))
         {
           location_mode_set (impl, LOCATION_MODE_PATH_BAR, TRUE);
         }
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 0977040..4c52924 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -1244,7 +1244,7 @@ gtk_file_chooser_entry_focus (GtkWidget        *widget,
   /* This is a bit evil -- it makes Tab never leave the entry. It basically
    * makes it 'safe' for people to hit. */
   if ((direction == GTK_DIR_TAB_FORWARD) &&
-      (GTK_WIDGET_HAS_FOCUS (widget)) &&
+      (gtk_widget_has_focus (widget)) &&
       (! control_pressed))
     {
       if (chooser_entry->has_completion)
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c
index 10db08b..39545c4 100644
--- a/gtk/gtkhsv.c
+++ b/gtk/gtkhsv.c
@@ -1223,7 +1223,7 @@ paint_triangle (GtkHSV      *hsv,
   
   /* Draw focus outline */
 
-  if (GTK_WIDGET_HAS_FOCUS (hsv) &&
+  if (gtk_widget_has_focus (widget) &&
       !priv->focus_on_ring)
     {
       gint focus_width;
@@ -1291,7 +1291,7 @@ gtk_hsv_expose (GtkWidget      *widget,
 	 dest.width, dest.height);
   cairo_destroy (cr);
 
-  if (GTK_WIDGET_HAS_FOCUS (hsv) && priv->focus_on_ring)
+  if (gtk_widget_has_focus (widget) && priv->focus_on_ring)
     gtk_paint_focus (widget->style, widget->window,
 		     GTK_WIDGET_STATE (widget),
 		     &event->area, widget, NULL,
@@ -1313,7 +1313,7 @@ gtk_hsv_focus (GtkWidget       *widget,
   hsv = GTK_HSV (widget);
   priv = hsv->priv;
 
-  if (!GTK_WIDGET_HAS_FOCUS (hsv))
+  if (!gtk_widget_has_focus (widget))
     {
       if (dir == GTK_DIR_TAB_BACKWARD)
         priv->focus_on_ring = FALSE;
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 91d1cdf..872644c 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1875,7 +1875,7 @@ gtk_icon_view_remove_widget (GtkCellEditable *editable,
       info->editing = FALSE;
     }
 
-  if (GTK_WIDGET_HAS_FOCUS (editable))
+  if (gtk_widget_has_focus (GTK_WIDGET (editable)))
     gtk_widget_grab_focus (GTK_WIDGET (icon_view));
   
   g_signal_handlers_disconnect_by_func (editable,
@@ -2122,7 +2122,7 @@ gtk_icon_view_button_press (GtkWidget      *widget,
   if (event->window != icon_view->priv->bin_window)
     return FALSE;
 
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
@@ -3162,7 +3162,7 @@ gtk_icon_view_paint_item (GtkIconView     *icon_view,
   if (item->selected)
     {
       flags = GTK_CELL_RENDERER_SELECTED;
-      if (GTK_WIDGET_HAS_FOCUS (icon_view))
+      if (gtk_widget_has_focus (GTK_WIDGET (icon_view)))
 	state = GTK_STATE_SELECTED;
       else
 	state = GTK_STATE_ACTIVE;
@@ -3231,7 +3231,7 @@ gtk_icon_view_paint_item (GtkIconView     *icon_view,
     }
 
   if (draw_focus &&
-      GTK_WIDGET_HAS_FOCUS (icon_view) &&
+      gtk_widget_has_focus (GTK_WIDGET (icon_view)) &&
       item == icon_view->priv->cursor_item)
     {
       for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
@@ -3826,7 +3826,7 @@ gtk_icon_view_real_move_cursor (GtkIconView     *icon_view,
 			step == GTK_MOVEMENT_PAGES ||
 			step == GTK_MOVEMENT_BUFFER_ENDS, FALSE);
 
-  if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (icon_view)))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return FALSE;
 
   gtk_icon_view_stop_editing (icon_view, FALSE);
@@ -4081,7 +4081,7 @@ gtk_icon_view_move_cursor_up_down (GtkIconView *icon_view,
   gboolean dirty = FALSE;
   gint step;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (!icon_view->priv->cursor_item)
@@ -4150,7 +4150,7 @@ gtk_icon_view_move_cursor_page_up_down (GtkIconView *icon_view,
   GtkIconViewItem *item;
   gboolean dirty = FALSE;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (!icon_view->priv->cursor_item)
@@ -4207,7 +4207,7 @@ gtk_icon_view_move_cursor_left_right (GtkIconView *icon_view,
   gboolean dirty = FALSE;
   gint step;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (!icon_view->priv->cursor_item)
@@ -4276,7 +4276,7 @@ gtk_icon_view_move_cursor_start_end (GtkIconView *icon_view,
   GList *list;
   gboolean dirty = FALSE;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (count < 0)
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 86867f1..faa78e5 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3603,7 +3603,7 @@ gtk_label_expose (GtkWidget      *widget,
 
 
 	  state = GTK_STATE_SELECTED;
-	  if (!GTK_WIDGET_HAS_FOCUS (widget))
+	  if (!gtk_widget_has_focus (widget))
 	    state = GTK_STATE_ACTIVE;
 
           gdk_draw_layout_with_colors (widget->window,
@@ -3628,7 +3628,7 @@ gtk_label_expose (GtkWidget      *widget,
           GdkColor *link_color;
           GdkColor *visited_link_color;
 
-          if (info->selectable && GTK_WIDGET_HAS_FOCUS (widget))
+          if (info->selectable && gtk_widget_has_focus (widget))
 	    gtk_label_draw_cursor (label, x, y);
 
           focus_link = gtk_label_get_focus_link (label);
@@ -3667,7 +3667,7 @@ gtk_label_expose (GtkWidget      *widget,
               gdk_region_destroy (clip);
             }
 
-          if (focus_link && GTK_WIDGET_HAS_FOCUS (widget))
+          if (focus_link && gtk_widget_has_focus (widget))
             {
               range[0] = focus_link->start;
               range[1] = focus_link->end;
@@ -4190,7 +4190,7 @@ gtk_label_button_press (GtkWidget      *widget,
 
   if (event->button == 1)
     {
-      if (!GTK_WIDGET_HAS_FOCUS (widget))
+      if (!gtk_widget_has_focus (widget))
 	{
 	  label->in_click = TRUE;
 	  gtk_widget_grab_focus (widget);
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index 3fa7f95..9df3d05 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -452,7 +452,7 @@ static gboolean
 gtk_link_button_button_press (GtkWidget      *widget,
 			      GdkEventButton *event)
 {
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS))
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 1216c19..cf691f0 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -637,7 +637,7 @@ gtk_list_button_press (GtkWidget      *widget,
       else if (list_has_grab (list))
 	gtk_list_end_drag_selection (list);
 	  
-      if (!GTK_WIDGET_HAS_FOCUS(item))
+      if (!gtk_widget_has_focus(item))
 	gtk_widget_grab_focus (item);
 
       if (list->add_mode)
@@ -920,7 +920,7 @@ gtk_list_focus (GtkWidget        *widget,
   container = GTK_CONTAINER (widget);
   
   if (container->focus_child == NULL ||
-      !GTK_WIDGET_HAS_FOCUS (container->focus_child))
+      !gtk_widget_has_focus (container->focus_child))
     {
       if (GTK_LIST (container)->last_focus_child)
 	gtk_container_set_focus_child
@@ -1160,7 +1160,7 @@ gtk_list_clear_items (GtkList *list,
 	  else if (list->children)
 	    new_focus_child = list->children->data;
 
-	  if (GTK_WIDGET_HAS_FOCUS (container->focus_child))
+	  if (gtk_widget_has_focus (container->focus_child))
 	    grab_focus = TRUE;
 	}
     }
@@ -1280,7 +1280,7 @@ gtk_list_remove_items_internal (GtkList	 *list,
   if (container->focus_child)
     {
       old_focus_child = new_focus_child = container->focus_child;
-      if (GTK_WIDGET_HAS_FOCUS (container->focus_child))
+      if (gtk_widget_has_focus (container->focus_child))
 	grab_focus = TRUE;
     }
   else
@@ -1814,7 +1814,7 @@ gtk_list_undo_selection (GtkList *list)
       container = GTK_CONTAINER (list);
 
       if (container->focus_child &&
-	  GTK_WIDGET_HAS_FOCUS (container->focus_child))
+	  gtk_widget_has_focus (container->focus_child))
 	gtk_widget_grab_focus (list->undo_focus_child);
       else
 	gtk_container_set_focus_child (container, list->undo_focus_child);
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index cfa3685..5f26644 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -537,7 +537,7 @@ static gint
 gtk_list_item_button_press (GtkWidget      *widget,
 			    GdkEventButton *event)
 {
-  if (event->type == GDK_BUTTON_PRESS && !GTK_WIDGET_HAS_FOCUS (widget))
+  if (event->type == GDK_BUTTON_PRESS && !gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   return FALSE;
@@ -567,7 +567,7 @@ gtk_list_item_expose (GtkWidget      *widget,
 
       GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
 
-      if (GTK_WIDGET_HAS_FOCUS (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),
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index db873ce..3c639da 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2508,7 +2508,7 @@ gtk_notebook_arrow_button_press (GtkNotebook      *notebook,
   gboolean left = (ARROW_IS_LEFT (arrow) && !is_rtl) || 
                   (!ARROW_IS_LEFT (arrow) && is_rtl);
 
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
   
   notebook->button = button;
@@ -3272,7 +3272,7 @@ gtk_notebook_draw_focus (GtkWidget      *widget,
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
 
-  if (GTK_WIDGET_HAS_FOCUS (widget) && gtk_widget_is_drawable (widget) &&
+  if (gtk_widget_has_focus (widget) && gtk_widget_is_drawable (widget) &&
       notebook->show_tabs && notebook->cur_page &&
       notebook->cur_page->tab_label->window == event->window)
     {
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index c1b9ed7..4b077a6 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -506,7 +506,7 @@ gtk_option_menu_paint (GtkWidget    *widget,
       button_area.width = widget->allocation.width - 2 * border_width;
       button_area.height = widget->allocation.height - 2 * border_width;
 
-      if (!props.interior_focus && GTK_WIDGET_HAS_FOCUS (widget))
+      if (!props.interior_focus && gtk_widget_has_focus (widget))
 	{
 	  button_area.x += props.focus_width + props.focus_pad;
 	  button_area.y += props.focus_width + props.focus_pad;
@@ -535,7 +535,7 @@ gtk_option_menu_paint (GtkWidget    *widget,
 		     button_area.y + (button_area.height - props.indicator_size.height) / 2,
 		     props.indicator_size.width, props.indicator_size.height);
       
-      if (GTK_WIDGET_HAS_FOCUS (widget))
+      if (gtk_widget_has_focus (widget))
 	{
 	  if (props.interior_focus)
 	    {
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 624a52e..b713aa2 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1928,8 +1928,7 @@ gtk_range_expose (GtkWidget      *widget,
                          fill_width, fill_height);
 	}
 
-      if (sensitive &&
-          GTK_WIDGET_HAS_FOCUS (range))
+      if (sensitive && gtk_widget_has_focus (widget))
         gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
                          &area, widget, "trough",
                          widget->allocation.x + range->range_rect.x,
@@ -2182,7 +2181,7 @@ gtk_range_button_press (GtkWidget      *widget,
 {
   GtkRange *range = GTK_RANGE (widget);
   
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   /* ignore presses when we're already doing something else. */
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index 9d468b8..673e6f8 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -693,7 +693,7 @@ gtk_socket_key_event (GtkWidget   *widget,
 {
   GtkSocket *socket = GTK_SOCKET (widget);
   
-  if (GTK_WIDGET_HAS_FOCUS (socket) && socket->plug_window && !socket->plug_widget)
+  if (gtk_widget_has_focus (widget) && socket->plug_window && !socket->plug_widget)
     {
       _gtk_socket_windowing_send_key_event (socket, (GdkEvent *) event, FALSE);
 
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 792b402..509f918 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -994,13 +994,13 @@ gtk_spin_button_scroll (GtkWidget      *widget,
 
   if (event->direction == GDK_SCROLL_UP)
     {
-      if (!GTK_WIDGET_HAS_FOCUS (widget))
+      if (!gtk_widget_has_focus (widget))
 	gtk_widget_grab_focus (widget);
       gtk_spin_button_real_spin (spin, spin->adjustment->step_increment);
     }
   else if (event->direction == GDK_SCROLL_DOWN)
     {
-      if (!GTK_WIDGET_HAS_FOCUS (widget))
+      if (!gtk_widget_has_focus (widget))
 	gtk_widget_grab_focus (widget);
       gtk_spin_button_real_spin (spin, -spin->adjustment->step_increment); 
     }
@@ -1067,7 +1067,7 @@ gtk_spin_button_button_press (GtkWidget      *widget,
     {
       if (event->window == spin->panel)
 	{
-	  if (!GTK_WIDGET_HAS_FOCUS (widget))
+	  if (!gtk_widget_has_focus (widget))
 	    gtk_widget_grab_focus (widget);
 	  spin->button = event->button;
 	  
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 0d2f063..803923d 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -3534,7 +3534,7 @@ gtk_default_draw_box (GtkStyle      *style,
       
       if (state_type == GTK_STATE_SELECTED && detail && strcmp (detail, "paned") == 0)
 	{
-	  if (widget && !GTK_WIDGET_HAS_FOCUS (widget))
+	  if (widget && !gtk_widget_has_focus (widget))
 	    gc = style->base_gc[GTK_STATE_ACTIVE];
 	}
 
@@ -3658,7 +3658,7 @@ gtk_default_draw_flat_box (GtkStyle      *style,
 		   !strcmp ("cell_even_ruled_sorted", detail))
             {
 	      /* This has to be really broken; alex made me do it. -jrb */
-	      if (widget && GTK_WIDGET_HAS_FOCUS (widget))
+	      if (widget && gtk_widget_has_focus (widget))
 		gc1 = style->base_gc[state_type];
 	      else
 	        gc1 = style->base_gc[GTK_STATE_ACTIVE];
@@ -3666,7 +3666,7 @@ gtk_default_draw_flat_box (GtkStyle      *style,
 	  else if (!strcmp ("cell_odd_ruled", detail) ||
 		   !strcmp ("cell_odd_ruled_sorted", detail))
 	    {
-	      if (widget && GTK_WIDGET_HAS_FOCUS (widget))
+	      if (widget && gtk_widget_has_focus (widget))
 	        freeme = get_darkened_gc (window, &style->base[state_type], 1);
 	      else
 	        freeme = get_darkened_gc (window, &style->base[GTK_STATE_ACTIVE], 1);
@@ -4916,7 +4916,7 @@ gtk_default_draw_handle (GtkStyle      *style,
       xthick = 0;
       ythick = 0;
 
-      if (state_type == GTK_STATE_SELECTED && widget && !GTK_WIDGET_HAS_FOCUS (widget))
+      if (state_type == GTK_STATE_SELECTED && widget && !gtk_widget_has_focus (widget))
 	{
 	  GdkColor unfocused_light;
 
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 24f3b77..789cf98 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1433,7 +1433,7 @@ gtk_text_draw_focus (GtkWidget *widget)
       width = widget->allocation.width;
       height = widget->allocation.height;
       
-      if (GTK_WIDGET_HAS_FOCUS (widget))
+      if (gtk_widget_has_focus (widget))
 	{
 	  x += 1;
 	  y += 1;
@@ -1587,7 +1587,7 @@ gtk_text_button_press (GtkWidget      *widget,
   
   text->button = event->button;
   
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
   
   if (event->button == 1)
@@ -5117,7 +5117,7 @@ expose_text (GtkText* text, GdkRectangle *area, gboolean cursor)
 	    draw_line_wrap (text, pixels + CACHE_DATA(cache).font_ascent);
 	}
       
-      if (cursor && GTK_WIDGET_HAS_FOCUS (text))
+      if (cursor && gtk_widget_has_focus (GTK_WIDGET (text)))
 	{
 	  if (CACHE_DATA(cache).start.index <= text->cursor_mark.index &&
 	      CACHE_DATA(cache).end.index >= text->cursor_mark.index)
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index a5a6cd8..1b9a7f2 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -202,12 +202,12 @@ gtk_text_renderer_prepare_run (PangoRenderer  *renderer,
 
   if (text_renderer->state == SELECTED)
     {
-      if (GTK_WIDGET_HAS_FOCUS (text_renderer->widget))
+      if (gtk_widget_has_focus (text_renderer->widget))
 	fg_color = &text_renderer->widget->style->text[GTK_STATE_SELECTED];
       else
 	fg_color = &text_renderer->widget->style->text[GTK_STATE_ACTIVE];
     }
-  else if (text_renderer->state == CURSOR && GTK_WIDGET_HAS_FOCUS (text_renderer->widget))
+  else if (text_renderer->state == CURSOR && gtk_widget_has_focus (text_renderer->widget))
     fg_color = &text_renderer->widget->style->base[GTK_STATE_NORMAL];
   else
     fg_color = &appearance->fg_color;
@@ -259,12 +259,12 @@ gtk_text_renderer_draw_shape (PangoRenderer   *renderer,
 
   if (text_renderer->state == SELECTED)
     {
-      if (GTK_WIDGET_HAS_FOCUS (text_renderer->widget))
+      if (gtk_widget_has_focus (text_renderer->widget))
 	fg_gc = text_renderer->widget->style->text_gc[GTK_STATE_SELECTED];
       else
 	fg_gc = text_renderer->widget->style->text_gc[GTK_STATE_SELECTED];
     }
-  else if (text_renderer->state == CURSOR && GTK_WIDGET_HAS_FOCUS (text_renderer->widget))
+  else if (text_renderer->state == CURSOR && gtk_widget_has_focus (text_renderer->widget))
     fg_gc = text_renderer->widget->style->base_gc[GTK_STATE_NORMAL];
   else
     fg_gc = text_renderer->widget->style->text_gc[GTK_STATE_NORMAL];
@@ -481,7 +481,7 @@ render_para (GtkTextRenderer    *text_renderer,
 
   screen_width = line_display->total_width;
   
-  if (GTK_WIDGET_HAS_FOCUS (text_renderer->widget))
+  if (gtk_widget_has_focus (text_renderer->widget))
     state = GTK_STATE_SELECTED;
   else
     state = GTK_STATE_ACTIVE;
@@ -649,7 +649,7 @@ render_para (GtkTextRenderer    *text_renderer,
                 }
             }
 	  else if (line_display->has_block_cursor &&
-		   GTK_WIDGET_HAS_FOCUS (text_renderer->widget) &&
+		   gtk_widget_has_focus (text_renderer->widget) &&
 		   byte_offset <= line_display->insert_index &&
 		   (line_display->insert_index < byte_offset + line->length ||
 		    (at_last_line && line_display->insert_index == byte_offset + line->length)))
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 9bea6e4..1e79bd1 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -2371,13 +2371,13 @@ gtk_text_view_set_editable (GtkTextView *text_view,
       if (!setting)
 	{
 	  gtk_text_view_reset_im_context(text_view);
-	  if (GTK_WIDGET_HAS_FOCUS (text_view))
+	  if (gtk_widget_has_focus (GTK_WIDGET (text_view)))
 	    gtk_im_context_focus_out (text_view->im_context);
 	}
 
       text_view->editable = setting;
 
-      if (setting && GTK_WIDGET_HAS_FOCUS (text_view))
+      if (setting && gtk_widget_has_focus (GTK_WIDGET (text_view)))
 	gtk_im_context_focus_in (text_view->im_context);
 
       if (text_view->layout)
@@ -2806,7 +2806,7 @@ gtk_text_view_set_cursor_visible (GtkTextView *text_view,
     {
       text_view->cursor_visible = setting;
 
-      if (GTK_WIDGET_HAS_FOCUS (text_view))
+      if (gtk_widget_has_focus (GTK_WIDGET (text_view)))
         {
           if (text_view->layout)
             {
@@ -4681,7 +4681,7 @@ gtk_text_view_draw_focus (GtkWidget *widget)
   
   if (gtk_widget_is_drawable (widget))
     {
-      if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus)
+      if (gtk_widget_has_focus (widget) && !interior_focus)
         {          
           gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), 
                            NULL, widget, "textview",
@@ -4888,7 +4888,7 @@ blink_cb (gpointer data)
   text_view = GTK_TEXT_VIEW (data);
   priv = GTK_TEXT_VIEW_GET_PRIVATE (text_view);
 
-  if (!GTK_WIDGET_HAS_FOCUS (text_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (text_view)))
     {
       g_warning ("GtkTextView - did not receive focus-out-event. If you\n"
                  "connect a handler to this signal, it must return\n"
@@ -4958,7 +4958,7 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
 {
   if (text_view->layout != NULL &&
       text_view->cursor_visible &&
-      GTK_WIDGET_HAS_FOCUS (text_view))
+      gtk_widget_has_focus (GTK_WIDGET (text_view)))
     {
       if (cursor_blinks (text_view))
 	{
@@ -4989,7 +4989,7 @@ gtk_text_view_pend_cursor_blink (GtkTextView *text_view)
 {
   if (text_view->layout != NULL &&
       text_view->cursor_visible &&
-      GTK_WIDGET_HAS_FOCUS (text_view) &&
+      gtk_widget_has_focus (GTK_WIDGET (text_view)) &&
       cursor_blinks (text_view))
     {
       gtk_text_view_stop_cursor_blink (text_view);
@@ -6425,7 +6425,7 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
       if (get_buffer (text_view))
         gtk_text_layout_set_buffer (text_view->layout, get_buffer (text_view));
 
-      if ((GTK_WIDGET_HAS_FOCUS (text_view) && text_view->cursor_visible))
+      if ((gtk_widget_has_focus (widget) && text_view->cursor_visible))
         gtk_text_view_pend_cursor_blink (text_view);
       else
         gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
@@ -7402,7 +7402,7 @@ gtk_text_view_preedit_changed_handler (GtkIMContext *context,
 
   if (text_view->layout)
     gtk_text_layout_set_preedit_string (text_view->layout, str, attrs, cursor_pos);
-  if (GTK_WIDGET_HAS_FOCUS (text_view))
+  if (gtk_widget_has_focus (GTK_WIDGET (text_view)))
     gtk_text_view_scroll_mark_onscreen (text_view,
 					gtk_text_buffer_get_insert (get_buffer (text_view)));
 
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index 32c3140..00922eb 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -248,7 +248,7 @@ gtk_tray_icon_expose (GtkWidget      *widget,
     retval = GTK_WIDGET_CLASS (gtk_tray_icon_parent_class)->expose_event (widget, event);
 
   focus_child = GTK_CONTAINER (widget)->focus_child;
-  if (focus_child && GTK_WIDGET_HAS_FOCUS (focus_child))
+  if (focus_child && gtk_widget_has_focus (focus_child))
     {
       border_width = GTK_CONTAINER (widget)->border_width;
 
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index ef14f56..5488872 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -650,7 +650,7 @@ gtk_tree_item_paint (GtkWidget    *widget,
             }
 	}
 
-      if (GTK_WIDGET_HAS_FOCUS (widget))
+      if (gtk_widget_has_focus (widget))
 	gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
 			 NULL, widget, "treeitem",
 			 0, 0,
@@ -665,9 +665,9 @@ gtk_tree_item_button_press (GtkWidget      *widget,
 			    GdkEventButton *event)
 {
   if (event->type == GDK_BUTTON_PRESS
-	&& gtk_widget_is_sensitive(widget)
-     	&& !GTK_WIDGET_HAS_FOCUS (widget))
-      gtk_widget_grab_focus (widget);
+      && gtk_widget_is_sensitive(widget)
+      && !gtk_widget_has_focus (widget))
+    gtk_widget_grab_focus (widget);
 
   return (event->type == GDK_BUTTON_PRESS && gtk_widget_is_sensitive(widget));
 }
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 7e1c71c..620ccfc 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2496,8 +2496,10 @@ gtk_tree_view_size_allocate (GtkWidget     *widget,
 static void
 grab_focus_and_unset_draw_keyfocus (GtkTreeView *tree_view)
 {
-  if (gtk_widget_get_can_focus (GTK_WIDGET (tree_view)) && !GTK_WIDGET_HAS_FOCUS (tree_view))
-    gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+  GtkWidget *widget = GTK_WIDGET (tree_view);
+
+  if (gtk_widget_get_can_focus (widget) && !gtk_widget_has_focus (widget))
+    gtk_widget_grab_focus (widget);
   GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
 }
 
@@ -2913,7 +2915,7 @@ gtk_tree_view_button_press (GtkWidget      *widget,
 	  tree_view->priv->drag_pos = i;
 	  tree_view->priv->x_drag = column->button->allocation.x + (rtl ? 0 : column->button->allocation.width);
 
-	  if (!GTK_WIDGET_HAS_FOCUS (widget))
+	  if (!gtk_widget_has_focus (widget))
 	    gtk_widget_grab_focus (widget);
 
 	  return TRUE;
@@ -4178,7 +4180,7 @@ invalidate_empty_focus (GtkTreeView *tree_view)
 {
   GdkRectangle area;
 
-  if (!GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return;
 
   area.x = 0;
@@ -4195,7 +4197,7 @@ draw_empty_focus (GtkTreeView *tree_view, GdkRectangle *clip_area)
 {
   gint w, h;
 
-  if (!GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return;
 
   gdk_drawable_get_size (tree_view->priv->bin_window, &w, &h);
@@ -4785,7 +4787,7 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
 	  if (node == cursor && has_special_cell &&
 	      ((column == tree_view->priv->focus_column &&
 		GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS) &&
-		GTK_WIDGET_HAS_FOCUS (widget)) ||
+		gtk_widget_has_focus (widget)) ||
 	       (column == tree_view->priv->edited_column)))
 	    {
 	      _gtk_tree_view_column_cell_draw_focus (column,
@@ -4870,7 +4872,7 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
       /* draw the big row-spanning focus rectangle, if needed */
       if (!has_special_cell && node == cursor &&
 	  GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS) &&
-	  GTK_WIDGET_HAS_FOCUS (widget))
+	  gtk_widget_has_focus (widget))
         {
 	  gint tmp_y, tmp_height;
 	  gint width;
@@ -5307,7 +5309,7 @@ gtk_tree_view_key_press (GtkWidget   *widget,
         {
           GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (focus_column->data);
 
-          if (GTK_WIDGET_HAS_FOCUS (column->button))
+          if (gtk_widget_has_focus (column->button))
             break;
         }
 
@@ -5441,7 +5443,7 @@ gtk_tree_view_key_press (GtkWidget   *widget,
 
   /* We pass the event to the search_entry.  If its text changes, then we start
    * the typeahead find capabilities. */
-  if (GTK_WIDGET_HAS_FOCUS (tree_view)
+  if (gtk_widget_has_focus (GTK_WIDGET (tree_view))
       && tree_view->priv->enable_search
       && !tree_view->priv->search_custom_entry_set)
     {
@@ -7979,7 +7981,7 @@ gtk_tree_view_focus (GtkWidget        *widget,
     }
 
   /* Case 2. We don't have focus at all. */
-  if (!GTK_WIDGET_HAS_FOCUS (container))
+  if (!gtk_widget_has_focus (widget))
     {
       if (!gtk_tree_view_header_focus (tree_view, direction, FALSE))
 	gtk_widget_grab_focus (widget);
@@ -8137,7 +8139,7 @@ gtk_tree_view_real_move_cursor (GtkTreeView       *tree_view,
 
   if (tree_view->priv->tree == NULL)
     return FALSE;
-  if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (tree_view)))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return FALSE;
 
   gtk_tree_view_stop_editing (tree_view, FALSE);
@@ -9608,7 +9610,7 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
   gboolean grab_focus = TRUE;
   gboolean selectable;
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (! gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return;
 
   cursor_path = NULL;
@@ -9741,7 +9743,7 @@ gtk_tree_view_move_cursor_page_up_down (GtkTreeView *tree_view,
   gint window_y;
   gint vertical_separator;
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return;
 
   if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
@@ -9843,7 +9845,7 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
 
   rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return;
 
   if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
@@ -9937,7 +9939,7 @@ gtk_tree_view_move_cursor_start_end (GtkTreeView *tree_view,
   GtkTreePath *path;
   GtkTreePath *old_path;
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return;
 
   g_return_if_fail (tree_view->priv->tree != NULL);
@@ -9998,7 +10000,7 @@ cleanup:
 static gboolean
 gtk_tree_view_real_select_all (GtkTreeView *tree_view)
 {
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return FALSE;
 
   if (tree_view->priv->selection->type != GTK_SELECTION_MULTIPLE)
@@ -10012,7 +10014,7 @@ gtk_tree_view_real_select_all (GtkTreeView *tree_view)
 static gboolean
 gtk_tree_view_real_unselect_all (GtkTreeView *tree_view)
 {
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return FALSE;
 
   if (tree_view->priv->selection->type != GTK_SELECTION_MULTIPLE)
@@ -10034,7 +10036,7 @@ gtk_tree_view_real_select_cursor_row (GtkTreeView *tree_view,
   GtkTreePath *cursor_path = NULL;
   GtkTreeSelectMode mode = 0;
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return FALSE;
 
   if (tree_view->priv->cursor)
@@ -10106,7 +10108,7 @@ gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view)
   GtkRBNode *cursor_node = NULL;
   GtkTreePath *cursor_path = NULL;
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return FALSE;
 
   cursor_path = NULL;
@@ -10159,7 +10161,7 @@ gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view,
   GtkRBTree *tree;
   GtkRBNode *node;
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return FALSE;
 
   cursor_path = NULL;
@@ -10198,7 +10200,7 @@ gtk_tree_view_real_select_cursor_parent (GtkTreeView *tree_view)
   GtkTreePath *cursor_path = NULL;
   GdkModifierType state;
 
-  if (! GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     goto out;
 
   cursor_path = NULL;
@@ -10392,14 +10394,14 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
       if (! column->visible)
 	continue;
 
-      if (GTK_WIDGET_HAS_FOCUS (column->button))
+      if (gtk_widget_has_focus (column->button))
 	{
 	  found_focus = TRUE;
 	  break;
 	}
     }
   
-  if (GTK_WIDGET_HAS_FOCUS (tree_view))
+  if (gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     found_focus = TRUE;
 
   if (!found_focus)
@@ -14703,7 +14705,7 @@ gtk_tree_view_remove_widget (GtkCellEditable *cell_editable,
   _gtk_tree_view_column_stop_editing (tree_view->priv->edited_column);
   tree_view->priv->edited_column = NULL;
 
-  if (GTK_WIDGET_HAS_FOCUS (cell_editable))
+  if (gtk_widget_has_focus (GTK_WIDGET (cell_editable)))
     gtk_widget_grab_focus (GTK_WIDGET (tree_view));
 
   g_signal_handlers_disconnect_by_func (cell_editable,
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 396c816..48b61e5 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -1043,7 +1043,7 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
   else
     {
       GTK_WIDGET_UNSET_FLAGS (tree_column->button, GTK_CAN_FOCUS);
-      if (GTK_WIDGET_HAS_FOCUS (tree_column->button))
+      if (gtk_widget_has_focus (tree_column->button))
 	{
 	  GtkWidget *toplevel = gtk_widget_get_toplevel (tree_column->tree_view);
 	  if (gtk_widget_is_toplevel (toplevel))
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d06542a..34e27ac 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2752,7 +2752,7 @@ gtk_widget_get_property (GObject         *object,
       g_value_set_boolean (value, (gtk_widget_get_can_focus (widget) != FALSE));
       break;
     case PROP_HAS_FOCUS:
-      g_value_set_boolean (value, (GTK_WIDGET_HAS_FOCUS (widget) != FALSE));
+      g_value_set_boolean (value, (gtk_widget_has_focus (widget) != FALSE));
       break;
     case PROP_IS_FOCUS:
       g_value_set_boolean (value, (gtk_widget_is_focus (widget)));
@@ -5304,7 +5304,7 @@ gtk_widget_real_grab_focus (GtkWidget *focus_widget)
 	       * toplevel window can request the focus if necessary.
 	       * This is needed when the toplevel is a GtkPlug
 	       */
-	      if (!GTK_WIDGET_HAS_FOCUS (widget))
+	      if (!gtk_widget_has_focus (widget))
 		_gtk_window_internal_set_focus (GTK_WINDOW (toplevel), focus_widget);
 
 	      return;
@@ -5504,7 +5504,7 @@ gtk_widget_has_focus (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return GTK_WIDGET_HAS_FOCUS (widget);
+  return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_FOCUS) != 0;
 }
 
 /**
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 97bf956..b3439a7 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -296,14 +296,18 @@ typedef enum
 #define GTK_WIDGET_CAN_FOCUS(wid)	  ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
 #endif
 
+#ifndef GTK_DISABLE_DEPRECATED
 /**
  * GTK_WIDGET_HAS_FOCUS:
  * @wid: a #GtkWidget.
  *
  * Evaluates to %TRUE if the widget has grabbed the focus and no other
  * widget has done so more recently.
+ *
+ * Deprecated: 2.20: Use gtk_widget_has_focus() instead.
  */
 #define GTK_WIDGET_HAS_FOCUS(wid)	  ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
+#endif
 
 #ifndef GTK_DISABLE_DEPRECATED
 /**
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index fa98b8c..e28bffd 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1621,7 +1621,7 @@ _gtk_window_internal_set_focus (GtkWindow *window,
   g_return_if_fail (GTK_IS_WINDOW (window));
 
   if ((window->focus_widget != focus) ||
-      (focus && !GTK_WIDGET_HAS_FOCUS (focus)))
+      (focus && !gtk_widget_has_focus (focus)))
     g_signal_emit (window, window_signals[SET_FOCUS], 0, focus);
 }
 
@@ -1981,7 +1981,7 @@ gtk_window_activate_focus (GtkWindow *window)
  * Retrieves the current focused widget within the window.
  * Note that this is the widget that would have the focus
  * if the toplevel window focused; if the toplevel window
- * is not focused then  <literal>GTK_WIDGET_HAS_FOCUS (widget)</literal> will
+ * is not focused then  <literal>gtk_widget_has_focus (widget)</literal> will
  * not be %TRUE for the widget.
  *
  * Return value: (transfer none): the currently focused widget, or %NULL if there is none.
@@ -8331,14 +8331,14 @@ window_update_has_focus (GtkWindow *window)
 	{
 	  if (window->focus_widget &&
 	      window->focus_widget != widget &&
-	      !GTK_WIDGET_HAS_FOCUS (window->focus_widget))
+	      !gtk_widget_has_focus (window->focus_widget))
 	    do_focus_change (window->focus_widget, TRUE);	
 	}
       else
 	{
 	  if (window->focus_widget &&
 	      window->focus_widget != widget &&
-	      GTK_WIDGET_HAS_FOCUS (window->focus_widget))
+	      gtk_widget_has_focus (window->focus_widget))
 	    do_focus_change (window->focus_widget, FALSE);
 	}
     }
diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c
index 8163a7c..1e2d86a 100644
--- a/gtk/tests/builder.c
+++ b/gtk/tests/builder.c
@@ -1614,7 +1614,7 @@ test_widget (void)
   button1 = gtk_builder_get_object (builder, "button1");
 
 #if 0
-  g_assert (GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (button1)));
+  g_assert (gtk_widget_has_focus (GTK_WIDGET (button1)));
 #endif
   window1 = gtk_builder_get_object (builder, "window1");
   gtk_widget_destroy (GTK_WIDGET (window1));
diff --git a/gtk/tests/testing.c b/gtk/tests/testing.c
index 8feb71b..dcc2d02 100644
--- a/gtk/tests/testing.c
+++ b/gtk/tests/testing.c
@@ -61,7 +61,7 @@ test_button_keys (void)
   gboolean simsuccess;
   g_assert (button != NULL);
   gtk_widget_grab_focus (button);
-  g_assert (GTK_WIDGET_HAS_FOCUS (button));
+  g_assert (gtk_widget_has_focus (button));
   simsuccess = gtk_test_widget_send_key (button, GDK_Return, 0);
   g_assert (simsuccess == TRUE);
   while (gtk_events_pending ())
diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c
index a7e1e63..c69d1c7 100755
--- a/modules/engines/ms-windows/msw_style.c
+++ b/modules/engines/ms-windows/msw_style.c
@@ -1971,7 +1971,7 @@ draw_push_button (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
     }
   else
     {
-      if (is_default || GTK_WIDGET_HAS_FOCUS (widget))
+      if (is_default || gtk_widget_has_focus (widget))
 	{
 	  FrameRect (dc, &rect, GetSysColorBrush (COLOR_WINDOWFRAME));
 	  InflateRect (&rect, -1, -1);
@@ -2925,7 +2925,7 @@ draw_flat_box (GtkStyle *style, GdkWindow *window,
       if (state_type == GTK_STATE_SELECTED &&
 	  (!strncmp ("cell_even", detail, 9) || !strncmp ("cell_odd", detail, 8)))
 	{
-	  GdkGC *gc = GTK_WIDGET_HAS_FOCUS (widget) ? style->base_gc[state_type] : style->base_gc[GTK_STATE_ACTIVE];
+	  GdkGC *gc = gtk_widget_has_focus (widget) ? style->base_gc[state_type] : style->base_gc[GTK_STATE_ACTIVE];
 
 	  gdk_draw_rectangle (window, gc, TRUE, x, y, width, height);
 
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index 2167216..48a33d8 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -307,7 +307,7 @@ gail_focus_watcher (GSignalInvocationHint *ihint,
     }
   else
     {
-      if (event->type == GDK_MOTION_NOTIFY && GTK_WIDGET_HAS_FOCUS (widget))
+      if (event->type == GDK_MOTION_NOTIFY && gtk_widget_has_focus (widget))
         {
           if (widget == focus_widget)
             {
diff --git a/modules/other/gail/gailtreeview.c b/modules/other/gail/gailtreeview.c
index 5b8ddce..2db4583 100644
--- a/modules/other/gail/gailtreeview.c
+++ b/modules/other/gail/gailtreeview.c
@@ -2644,7 +2644,7 @@ idle_cursor_changed (gpointer data)
             }
           gail_tree_view->focus_cell = cell;
 
-          if (GTK_WIDGET_HAS_FOCUS (widget))
+          if (gtk_widget_has_focus (widget))
             {
               gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_ACTIVE, FALSE);
               gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_FOCUSED, FALSE);
diff --git a/modules/other/gail/gailwidget.c b/modules/other/gail/gailwidget.c
index 96e0015..1732882 100644
--- a/modules/other/gail/gailwidget.c
+++ b/modules/other/gail/gailwidget.c
@@ -521,7 +521,7 @@ gail_widget_ref_state_set (AtkObject *accessible)
             }
         }
   
-      if (GTK_WIDGET_HAS_FOCUS (widget) && (widget == focus_widget))
+      if (gtk_widget_has_focus (widget) && (widget == focus_widget))
         {
           AtkObject *focus_obj;
 



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