Deprecate widget flag: GTK_WIDGET_HAS_FOCUS

Use gtk_widget_has_focus() instead

https://bugzilla.gnome.org/show_bug.cgi?id=69872
This commit is contained in:
Javier Jardón 2010-03-01 04:21:41 +01:00 committed by Tristan Van Berkom
parent c3f8b4226d
commit eb90ec7513
46 changed files with 178 additions and 164 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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))

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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));

View File

@ -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"

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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);
}
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;
@ -4343,7 +4343,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);

View File

@ -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))

View File

@ -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);

View File

@ -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),

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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. */

View File

@ -703,7 +703,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);

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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)))

View File

@ -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)));

View File

@ -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;

View File

@ -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));
}

View File

@ -2531,8 +2531,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);
}
@ -2948,7 +2950,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;
@ -4213,7 +4215,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;
@ -4230,7 +4232,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);
@ -4820,7 +4822,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,
@ -4905,7 +4907,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;
@ -5342,7 +5344,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;
}
@ -5476,7 +5478,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)
{
@ -8025,7 +8027,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);
@ -8183,7 +8185,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);
@ -9654,7 +9656,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;
@ -9787,7 +9789,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))
@ -9889,7 +9891,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))
@ -9983,7 +9985,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);
@ -10044,7 +10046,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)
@ -10058,7 +10060,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)
@ -10080,7 +10082,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)
@ -10152,7 +10154,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;
@ -10205,7 +10207,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;
@ -10244,7 +10246,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;
@ -10438,14 +10440,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)
@ -14749,7 +14751,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,

View File

@ -1051,7 +1051,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))

View File

@ -2766,7 +2766,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)));
@ -5319,7 +5319,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;
@ -5519,7 +5519,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;
}
/**

View File

@ -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
/**

View File

@ -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);
}
}

View File

@ -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));

View File

@ -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 ())

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -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;