Commit eb90ec75 authored by Javier Jardón's avatar Javier Jardón Committed by Tristan Van Berkom

Deprecate widget flag: GTK_WIDGET_HAS_FOCUS

Use gtk_widget_has_focus() instead

https://bugzilla.gnome.org/show_bug.cgi?id=69872
parent c3f8b422
......@@ -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)
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -1643,7 +1643,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;
......@@ -1756,7 +1756,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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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))
......
......@@ -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);
......
......@@ -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)
......
......@@ -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);
......
......@@ -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;
}
}
......
......@@ -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));
......
......@@ -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"
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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;
......
......@@ -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)
......
......@@ -3756,7 +3756,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,
......@@ -3781,7 +3781,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);
......@@ -3820,7 +3820,7 @@ gtk_label_expose (GtkWidget *widget,
gdk_region_destroy (clip);
}