mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
Deprecate widget flag: GTK_WIDGET_CAN_FOCUS
https://bugzilla.gnome.org/show_bug.cgi?id=69872
This commit is contained in:
parent
51e0dd9a82
commit
56a893ca8c
@ -1429,7 +1429,7 @@ gtk_button_size_allocate (GtkWidget *widget,
|
||||
child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CAN_FOCUS (button))
|
||||
if (gtk_widget_get_can_focus (GTK_WIDGET (button)))
|
||||
{
|
||||
child_allocation.x += focus_width + focus_pad;
|
||||
child_allocation.y += focus_width + focus_pad;
|
||||
|
@ -1811,7 +1811,7 @@ gtk_container_focus (GtkWidget *widget,
|
||||
|
||||
return_val = FALSE;
|
||||
|
||||
if (GTK_WIDGET_CAN_FOCUS (container))
|
||||
if (gtk_widget_get_can_focus (GTK_WIDGET (container)))
|
||||
{
|
||||
if (!GTK_WIDGET_HAS_FOCUS (container))
|
||||
{
|
||||
|
@ -1454,7 +1454,7 @@ gtk_label_mnemonic_activate (GtkWidget *widget,
|
||||
|
||||
while (parent)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS (parent) ||
|
||||
if (gtk_widget_get_can_focus (parent) ||
|
||||
(!group_cycling && GTK_WIDGET_GET_CLASS (parent)->activate_signal) ||
|
||||
GTK_IS_NOTEBOOK (parent->parent) ||
|
||||
GTK_IS_MENU_ITEM (parent))
|
||||
|
@ -1574,7 +1574,7 @@ gtk_range_expose (GtkWidget *widget,
|
||||
g_object_get (gtk_widget_get_settings (widget),
|
||||
"gtk-touchscreen-mode", &touchscreen,
|
||||
NULL);
|
||||
if (GTK_WIDGET_CAN_FOCUS (range))
|
||||
if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
|
||||
gtk_widget_style_get (GTK_WIDGET (range),
|
||||
"focus-line-width", &focus_line_width,
|
||||
"focus-padding", &focus_padding,
|
||||
@ -2766,7 +2766,7 @@ gtk_range_get_props (GtkRange *range,
|
||||
if (tmp_stepper_spacing > 0)
|
||||
tmp_trough_under_steppers = FALSE;
|
||||
|
||||
if (GTK_WIDGET_CAN_FOCUS (range))
|
||||
if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
|
||||
{
|
||||
gint focus_line_width;
|
||||
gint focus_padding;
|
||||
|
@ -1620,7 +1620,7 @@ gtk_scrolled_window_focus (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!had_focus_child && GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (!had_focus_child && gtk_widget_get_can_focus (widget))
|
||||
{
|
||||
gtk_widget_grab_focus (widget);
|
||||
return TRUE;
|
||||
|
@ -456,7 +456,7 @@ gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
|
||||
* gtk_widget_real_mnemonic_activate() in order to focus the widget even
|
||||
* if there is no mnemonic conflict.
|
||||
*/
|
||||
if (GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (gtk_widget_get_can_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
if (!group_cycling)
|
||||
|
@ -1326,8 +1326,7 @@ gtk_tree_view_init (GtkTreeView *tree_view)
|
||||
{
|
||||
tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree_view, GTK_TYPE_TREE_VIEW, GtkTreeViewPrivate);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (tree_view, GTK_CAN_FOCUS);
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (tree_view), TRUE);
|
||||
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (tree_view), FALSE);
|
||||
|
||||
tree_view->priv->flags = GTK_TREE_VIEW_SHOW_EXPANDERS
|
||||
@ -2497,7 +2496,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||
static void
|
||||
grab_focus_and_unset_draw_keyfocus (GtkTreeView *tree_view)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS (tree_view) && !GTK_WIDGET_HAS_FOCUS (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));
|
||||
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
|
||||
}
|
||||
@ -7767,7 +7766,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
|
||||
first_column = tree_view->priv->columns;
|
||||
while (first_column)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (first_column->data)->button) &&
|
||||
if (gtk_widget_get_can_focus (GTK_TREE_VIEW_COLUMN (first_column->data)->button) &&
|
||||
GTK_TREE_VIEW_COLUMN (first_column->data)->visible &&
|
||||
(GTK_TREE_VIEW_COLUMN (first_column->data)->clickable ||
|
||||
GTK_TREE_VIEW_COLUMN (first_column->data)->reorderable))
|
||||
@ -7783,7 +7782,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
|
||||
last_column = g_list_last (tree_view->priv->columns);
|
||||
while (last_column)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (last_column->data)->button) &&
|
||||
if (gtk_widget_get_can_focus (GTK_TREE_VIEW_COLUMN (last_column->data)->button) &&
|
||||
GTK_TREE_VIEW_COLUMN (last_column->data)->visible &&
|
||||
(GTK_TREE_VIEW_COLUMN (last_column->data)->clickable ||
|
||||
GTK_TREE_VIEW_COLUMN (last_column->data)->reorderable))
|
||||
@ -7802,7 +7801,8 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
|
||||
case GTK_DIR_DOWN:
|
||||
if (focus_child == NULL)
|
||||
{
|
||||
if (tree_view->priv->focus_column != NULL && GTK_WIDGET_CAN_FOCUS (tree_view->priv->focus_column->button))
|
||||
if (tree_view->priv->focus_column != NULL &&
|
||||
gtk_widget_get_can_focus (tree_view->priv->focus_column->button))
|
||||
focus_child = tree_view->priv->focus_column->button;
|
||||
else
|
||||
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
|
||||
@ -7861,7 +7861,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
|
||||
column = tmp_list->data;
|
||||
if (column->button &&
|
||||
column->visible &&
|
||||
GTK_WIDGET_CAN_FOCUS (column->button))
|
||||
gtk_widget_get_can_focus (column->button))
|
||||
{
|
||||
focus_child = column->button;
|
||||
gtk_widget_grab_focus (column->button);
|
||||
@ -7950,7 +7950,7 @@ gtk_tree_view_focus (GtkWidget *widget,
|
||||
GtkContainer *container = GTK_CONTAINER (widget);
|
||||
GtkWidget *focus_child;
|
||||
|
||||
if (!GTK_WIDGET_IS_SENSITIVE (container) || !GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (!GTK_WIDGET_IS_SENSITIVE (container) || !gtk_widget_get_can_focus (widget))
|
||||
return FALSE;
|
||||
|
||||
focus_child = container->focus_child;
|
||||
|
@ -1138,7 +1138,7 @@ gtk_tree_view_column_mnemonic_activate (GtkWidget *widget,
|
||||
GTK_TREE_VIEW (column->tree_view)->priv->focus_column = column;
|
||||
if (column->clickable)
|
||||
gtk_button_clicked (GTK_BUTTON (column->button));
|
||||
else if (GTK_WIDGET_CAN_FOCUS (column->button))
|
||||
else if (gtk_widget_get_can_focus (column->button))
|
||||
gtk_widget_grab_focus (column->button);
|
||||
else
|
||||
gtk_widget_grab_focus (column->tree_view);
|
||||
|
@ -2746,7 +2746,7 @@ gtk_widget_get_property (GObject *object,
|
||||
g_value_set_boolean (value, (gtk_widget_get_app_paintable (widget) != FALSE));
|
||||
break;
|
||||
case PROP_CAN_FOCUS:
|
||||
g_value_set_boolean (value, (GTK_WIDGET_CAN_FOCUS (widget) != FALSE));
|
||||
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));
|
||||
@ -4654,7 +4654,7 @@ gtk_widget_real_mnemonic_activate (GtkWidget *widget,
|
||||
{
|
||||
if (!group_cycling && GTK_WIDGET_GET_CLASS (widget)->activate_signal)
|
||||
gtk_widget_activate (widget);
|
||||
else if (GTK_WIDGET_CAN_FOCUS (widget))
|
||||
else if (gtk_widget_get_can_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
else
|
||||
{
|
||||
@ -5279,7 +5279,7 @@ reset_focus_recurse (GtkWidget *widget,
|
||||
static void
|
||||
gtk_widget_real_grab_focus (GtkWidget *focus_widget)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS (focus_widget))
|
||||
if (gtk_widget_get_can_focus (focus_widget))
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *widget;
|
||||
@ -5379,7 +5379,7 @@ static gboolean
|
||||
gtk_widget_real_focus (GtkWidget *widget,
|
||||
GtkDirectionType direction)
|
||||
{
|
||||
if (!GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (!gtk_widget_get_can_focus (widget))
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_widget_is_focus (widget))
|
||||
@ -5451,7 +5451,7 @@ gtk_widget_set_can_focus (GtkWidget *widget,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
if (can_focus != GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (can_focus != gtk_widget_get_can_focus (widget))
|
||||
{
|
||||
if (can_focus)
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
|
||||
@ -5479,7 +5479,7 @@ gtk_widget_get_can_focus (GtkWidget *widget)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
|
||||
return GTK_WIDGET_CAN_FOCUS (widget);
|
||||
return (GTK_WIDGET_FLAGS (widget) & GTK_CAN_FOCUS) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7518,7 +7518,7 @@ gtk_widget_child_focus (GtkWidget *widget,
|
||||
* don't have to though.
|
||||
*/
|
||||
if (!GTK_IS_CONTAINER (widget) &&
|
||||
!GTK_WIDGET_CAN_FOCUS (widget))
|
||||
!gtk_widget_get_can_focus (widget))
|
||||
return FALSE;
|
||||
|
||||
g_signal_emit (widget,
|
||||
|
@ -272,13 +272,18 @@ typedef enum
|
||||
*/
|
||||
#define GTK_WIDGET_IS_SENSITIVE(wid) (GTK_WIDGET_SENSITIVE (wid) && \
|
||||
GTK_WIDGET_PARENT_SENSITIVE (wid))
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
/**
|
||||
* GTK_WIDGET_CAN_FOCUS:
|
||||
* @wid: a #GtkWidget.
|
||||
*
|
||||
* Evaluates to %TRUE if the widget is able to handle focus grabs.
|
||||
*
|
||||
* Deprecated: 2.20: Use gtk_widget_get_can_focus() instead.
|
||||
*/
|
||||
#define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GTK_WIDGET_HAS_FOCUS:
|
||||
|
@ -1590,7 +1590,7 @@ gtk_window_set_focus (GtkWindow *window,
|
||||
if (focus)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_WIDGET (focus));
|
||||
g_return_if_fail (GTK_WIDGET_CAN_FOCUS (focus));
|
||||
g_return_if_fail (gtk_widget_get_can_focus (focus));
|
||||
}
|
||||
|
||||
if (focus)
|
||||
|
@ -3479,7 +3479,7 @@ draw_focus (GtkStyle *style,
|
||||
HDC dc;
|
||||
RECT rect;
|
||||
|
||||
if (!GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (!gtk_widget_get_can_focus (widget))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ gail_button_ref_state_set (AtkObject *obj)
|
||||
if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_ARMED);
|
||||
|
||||
if (!GTK_WIDGET_CAN_FOCUS(widget))
|
||||
if (!gtk_widget_get_can_focus (widget))
|
||||
atk_state_set_remove_state (state_set, ATK_STATE_SELECTABLE);
|
||||
|
||||
|
||||
|
@ -464,7 +464,7 @@ gail_label_ref_relation_set (AtkObject *obj)
|
||||
AtkObject *accessible_array[1];
|
||||
AtkRelation* relation;
|
||||
|
||||
if (!GTK_WIDGET_CAN_FOCUS (mnemonic_widget))
|
||||
if (!gtk_widget_get_can_focus (mnemonic_widget))
|
||||
{
|
||||
/*
|
||||
* Handle the case where a GtkFileChooserButton is specified as the
|
||||
|
@ -488,7 +488,7 @@ gail_widget_ref_state_set (AtkObject *accessible)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (gtk_widget_get_can_focus (widget))
|
||||
{
|
||||
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
|
||||
}
|
||||
@ -735,7 +735,7 @@ gail_widget_grab_focus (AtkComponent *component)
|
||||
GtkWidget *toplevel;
|
||||
|
||||
gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
if (GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (gtk_widget_get_can_focus (widget))
|
||||
{
|
||||
gtk_widget_grab_focus (widget);
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
Loading…
Reference in New Issue
Block a user