diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index e55574619c..10280a9041 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -540,7 +540,7 @@ gtk_button_init (GtkButton *button) { GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (button), TRUE); gtk_widget_set_receives_default (GTK_WIDGET (button), TRUE); GTK_WIDGET_SET_FLAGS (button, GTK_NO_WINDOW); diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 34011972ea..319a9e63a5 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -667,7 +667,7 @@ gtk_calendar_init (GtkCalendar *calendar) GTK_TYPE_CALENDAR, GtkCalendarPrivate); - GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (widget, TRUE); if (!default_abbreviated_dayname[0]) for (i=0; i<7; i++) diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 50a02161c5..2369bd7e5b 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -1010,7 +1010,7 @@ gtk_clist_init (GtkCList *clist) clist->flags = 0; GTK_WIDGET_UNSET_FLAGS (clist, GTK_NO_WINDOW); - GTK_WIDGET_SET_FLAGS (clist, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (clist), TRUE); GTK_CLIST_SET_FLAG (clist, CLIST_DRAW_DRAG_LINE); GTK_CLIST_SET_FLAG (clist, CLIST_USE_DRAG_ICONS); @@ -1378,7 +1378,7 @@ gtk_clist_column_title_active (GtkCList *clist, G_CALLBACK (column_title_passive_func), NULL); - GTK_WIDGET_SET_FLAGS (clist->column[column].button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (clist->column[column].button, TRUE); if (gtk_widget_get_visible (GTK_WIDGET (clist))) gtk_widget_queue_draw (clist->column[column].button); } @@ -1409,7 +1409,7 @@ gtk_clist_column_title_passive (GtkCList *clist, G_CALLBACK (column_title_passive_func), NULL); - GTK_WIDGET_UNSET_FLAGS (clist->column[column].button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (clist->column[column].button, FALSE); if (gtk_widget_get_visible (GTK_WIDGET (clist))) gtk_widget_queue_draw (clist->column[column].button); } diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 80368a32c1..6c80dce54d 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -1547,7 +1547,7 @@ palette_new (GtkColorSelection *colorsel) retval = gtk_drawing_area_new (); - GTK_WIDGET_SET_FLAGS (retval, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (retval, TRUE); g_object_set_data (G_OBJECT (retval), I_("color_set"), GINT_TO_POINTER (0)); gtk_widget_set_events (retval, GDK_BUTTON_PRESS_MASK diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index a911697b3c..69ab413bab 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -551,10 +551,10 @@ gtk_combo_popup_list (GtkCombo *combo) } else { - GTK_WIDGET_SET_FLAGS (list, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (list), TRUE); gtk_widget_grab_focus (combo->list); GTK_LIST (combo->list)->last_focus_child = NULL; - GTK_WIDGET_UNSET_FLAGS (list, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (list), FALSE); } gtk_window_move (GTK_WINDOW (combo->popwin), x, y); @@ -924,7 +924,7 @@ gtk_combo_init (GtkCombo * combo) gtk_container_add (GTK_CONTAINER (combo->button), arrow); gtk_box_pack_start (GTK_BOX (combo), combo->entry, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (combo), combo->button, FALSE, FALSE, 0); - GTK_WIDGET_UNSET_FLAGS (combo->button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (combo->button, FALSE); gtk_widget_show (combo->entry); gtk_widget_show (combo->button); combo->entry_change_id = g_signal_connect (combo->entry, "changed", @@ -968,8 +968,8 @@ gtk_combo_init (GtkCombo * combo) combo->popup = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->hscrollbar, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->vscrollbar, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_SCROLLED_WINDOW (combo->popup)->hscrollbar, FALSE); + gtk_widget_set_can_focus (GTK_SCROLLED_WINDOW (combo->popup)->vscrollbar, FALSE); gtk_container_add (GTK_CONTAINER (frame), combo->popup); gtk_widget_show (combo->popup); diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 072e376957..37c4942758 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -5612,7 +5612,7 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, cell_editable, 0); gtk_widget_grab_focus (GTK_WIDGET (GTK_BIN (combo_box)->child)); - GTK_WIDGET_UNSET_FLAGS (combo_box->priv->button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (combo_box->priv->button, FALSE); } /* we do the immediate popup only for the optionmenu-like diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 9fbd962b66..104b88e9dd 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -2294,7 +2294,7 @@ gtk_entry_init (GtkEntry *entry) { GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry); - GTK_WIDGET_SET_FLAGS (entry, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (entry), TRUE); entry->editable = TRUE; entry->visible = TRUE; diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 2362a2d3df..ec8971e465 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -266,7 +266,7 @@ gtk_expander_init (GtkExpander *expander) expander->priv = priv = GTK_EXPANDER_GET_PRIVATE (expander); - GTK_WIDGET_SET_FLAGS (expander, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (expander), TRUE); GTK_WIDGET_SET_FLAGS (expander, GTK_NO_WINDOW); priv->label_widget = NULL; diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c index 39545c4cc8..45df0a0702 100644 --- a/gtk/gtkhsv.c +++ b/gtk/gtkhsv.c @@ -214,7 +214,7 @@ gtk_hsv_init (GtkHSV *hsv) hsv->priv = priv; GTK_WIDGET_SET_FLAGS (hsv, GTK_NO_WINDOW); - GTK_WIDGET_SET_FLAGS (hsv, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (hsv), TRUE); priv->h = 0.0; priv->s = 0.0; diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 15fdb6ff3e..716612057e 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -1106,7 +1106,7 @@ gtk_icon_view_init (GtkIconView *icon_view) icon_view->priv->pixbuf_cell = -1; icon_view->priv->tooltip_column = -1; - GTK_WIDGET_SET_FLAGS (icon_view, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (icon_view), TRUE); gtk_icon_view_set_adjustments (icon_view, NULL, NULL); diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index ccc9c895cb..46016713dc 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -4604,7 +4604,7 @@ gtk_label_ensure_select_info (GtkLabel *label) { label->select_info = g_new0 (GtkLabelSelectionInfo, 1); - GTK_WIDGET_SET_FLAGS (label, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (label), TRUE); if (GTK_WIDGET_REALIZED (label)) gtk_label_create_window (label); @@ -4627,7 +4627,7 @@ gtk_label_clear_select_info (GtkLabel *label) g_free (label->select_info); label->select_info = NULL; - GTK_WIDGET_UNSET_FLAGS (label, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (label), FALSE); } } diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index 1983f9f99a..f1b64d7ac5 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -382,7 +382,7 @@ gtk_list_item_class_init (GtkListItemClass *class) static void gtk_list_item_init (GtkListItem *list_item) { - GTK_WIDGET_SET_FLAGS (list_item, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (list_item), TRUE); } GtkWidget* diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index fd8075b7cf..2408fc1eae 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1071,7 +1071,7 @@ gtk_notebook_init (GtkNotebook *notebook) { GtkNotebookPrivate *priv; - GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE); GTK_WIDGET_SET_FLAGS (notebook, GTK_NO_WINDOW); priv = GTK_NOTEBOOK_GET_PRIVATE (notebook); @@ -6904,7 +6904,7 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook, if (!show_tabs) { - GTK_WIDGET_UNSET_FLAGS (notebook, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (notebook), FALSE); while (children) { @@ -6921,7 +6921,7 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook, } else { - GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE); gtk_notebook_update_labels (notebook); } diff --git a/gtk/gtkoldeditable.c b/gtk/gtkoldeditable.c index f1bf74d0cf..f38022c90f 100644 --- a/gtk/gtkoldeditable.c +++ b/gtk/gtkoldeditable.c @@ -362,7 +362,7 @@ gtk_old_editable_init (GtkOldEditable *old_editable) { "COMPOUND_TEXT", 0, 0 } }; - GTK_WIDGET_SET_FLAGS (old_editable, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (old_editable), TRUE); old_editable->selection_start_pos = 0; old_editable->selection_end_pos = 0; diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index 19c4f58d63..e56290ea2b 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -186,7 +186,7 @@ gtk_option_menu_child_type (GtkContainer *container) static void gtk_option_menu_init (GtkOptionMenu *option_menu) { - GTK_WIDGET_SET_FLAGS (option_menu, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (option_menu), TRUE); GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_DEFAULT); gtk_widget_set_receives_default (GTK_WIDGET (option_menu), FALSE); diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 7beb73780f..17d401621c 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -559,7 +559,8 @@ gtk_paned_child_type (GtkContainer *container) static void gtk_paned_init (GtkPaned *paned) { - GTK_WIDGET_SET_FLAGS (paned, GTK_NO_WINDOW | GTK_CAN_FOCUS); + GTK_WIDGET_SET_FLAGS (paned, GTK_NO_WINDOW); + gtk_widget_set_can_focus (GTK_WIDGET (paned), TRUE); /* We only need to redraw when the handle position moves, which is * independent of the overall allocation of the GtkPaned @@ -1196,9 +1197,9 @@ gtk_paned_focus (GtkWidget *widget, * excessive cut-and-paste from gtkcontainer.c? */ - GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (widget, FALSE); retval = GTK_WIDGET_CLASS (gtk_paned_parent_class)->focus (widget, direction); - GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (widget, TRUE); return retval; } diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 02222a08e0..7e7a36c1d2 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -390,7 +390,7 @@ gtk_scale_init (GtkScale *scale) { GtkRange *range = GTK_RANGE (scale); - GTK_WIDGET_SET_FLAGS (scale, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (scale), TRUE); range->slider_size_fixed = TRUE; range->has_stepper_a = FALSE; diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 67274e7ecc..15667996ca 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -362,7 +362,8 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) static void gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window) { - GTK_WIDGET_SET_FLAGS (scrolled_window, GTK_NO_WINDOW | GTK_CAN_FOCUS); + GTK_WIDGET_SET_FLAGS (scrolled_window, GTK_NO_WINDOW); + gtk_widget_set_can_focus (GTK_WIDGET (scrolled_window), TRUE); scrolled_window->hscrollbar = NULL; scrolled_window->vscrollbar = NULL; diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c index 673e6f8bb8..ff9e387930 100644 --- a/gtk/gtksocket.c +++ b/gtk/gtksocket.c @@ -724,14 +724,16 @@ void _gtk_socket_claim_focus (GtkSocket *socket, gboolean send_event) { + GtkWidget *widget = GTK_WIDGET (socket); + if (!send_event) socket->focus_in = TRUE; /* Otherwise, our notify handler will send FOCUS_IN */ /* Oh, the trickery... */ - GTK_WIDGET_SET_FLAGS (socket, GTK_CAN_FOCUS); - gtk_widget_grab_focus (GTK_WIDGET (socket)); - GTK_WIDGET_UNSET_FLAGS (socket, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (widget, TRUE); + gtk_widget_grab_focus (widget); + gtk_widget_set_can_focus (widget, FALSE); } static gboolean diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index de97c84cbd..1ce60affd7 100644 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -861,7 +861,7 @@ gtk_status_icon_init (GtkStatusIcon *status_icon) g_signal_connect_swapped (priv->tray_icon, "screen-changed", G_CALLBACK (gtk_status_icon_screen_changed), status_icon); priv->image = gtk_image_new (); - GTK_WIDGET_SET_FLAGS (priv->image, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (priv->image, TRUE); gtk_container_add (GTK_CONTAINER (priv->tray_icon), priv->image); gtk_widget_show (priv->image); diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 789cf98b17..960051c44b 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -654,7 +654,7 @@ gtk_text_editable_init (GtkEditableClass *iface) static void gtk_text_init (GtkText *text) { - GTK_WIDGET_SET_FLAGS (text, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (text), TRUE); text->text_area = NULL; text->hadj = NULL; diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 589e8af859..b0ef1d0241 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1291,7 +1291,7 @@ gtk_text_view_init (GtkTextView *text_view) GtkWidget *widget = GTK_WIDGET (text_view); GtkTargetList *target_list; - GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (widget, TRUE); /* Set up default style */ text_view->wrap_mode = GTK_WRAP_NONE; @@ -4717,9 +4717,9 @@ gtk_text_view_focus (GtkWidget *widget, * Unset CAN_FOCUS flag so that gtk_container_focus() allows * children to get the focus */ - GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (widget, FALSE); result = GTK_WIDGET_CLASS (gtk_text_view_parent_class)->focus (widget, direction); - GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (widget, TRUE); return result; } diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 44f6ad16ac..261bfc15c1 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -667,7 +667,7 @@ gtk_toolbar_init (GtkToolbar *toolbar) { GtkToolbarPrivate *priv; - GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (toolbar), FALSE); GTK_WIDGET_SET_FLAGS (toolbar, GTK_NO_WINDOW); priv = GTK_TOOLBAR_GET_PRIVATE (toolbar); diff --git a/gtk/gtktoolitem.c b/gtk/gtktoolitem.c index 9b62ced72d..143e904b79 100644 --- a/gtk/gtktoolitem.c +++ b/gtk/gtktoolitem.c @@ -308,7 +308,7 @@ gtk_tool_item_class_init (GtkToolItemClass *klass) static void gtk_tool_item_init (GtkToolItem *toolitem) { - GTK_WIDGET_UNSET_FLAGS (toolitem, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (toolitem), FALSE); toolitem->priv = GTK_TOOL_ITEM_GET_PRIVATE (toolitem); diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 801b237404..9b9e82fc5a 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -225,7 +225,7 @@ gtk_tree_item_init (GtkTreeItem *tree_item) tree_item->expanded = FALSE; tree_item->subtree = NULL; - GTK_WIDGET_SET_FLAGS (tree_item, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (tree_item), TRUE); /* create an event box containing one pixmaps */ eventbox = gtk_event_box_new(); diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index 48b61e581b..ffeef675f2 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -1038,11 +1038,11 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column) if (tree_column->reorderable || tree_column->clickable) { - GTK_WIDGET_SET_FLAGS (tree_column->button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (tree_column->button, TRUE); } else { - GTK_WIDGET_UNSET_FLAGS (tree_column->button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (tree_column->button, FALSE); if (gtk_widget_has_focus (tree_column->button)) { GtkWidget *toplevel = gtk_widget_get_toplevel (tree_column->tree_view); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 7dfdcb1926..42980191e0 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -5459,9 +5459,9 @@ gtk_widget_set_can_focus (GtkWidget *widget, if (can_focus != gtk_widget_get_can_focus (widget)) { if (can_focus) - GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); + GTK_OBJECT_FLAGS (widget) |= GTK_CAN_FOCUS; else - GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS); + GTK_OBJECT_FLAGS (widget) &= ~(GTK_CAN_FOCUS); gtk_widget_queue_resize (widget); g_object_notify (G_OBJECT (widget), "can-focus"); diff --git a/tests/testinput.c b/tests/testinput.c index 96b66f4602..fb04c22a57 100644 --- a/tests/testinput.c +++ b/tests/testinput.c @@ -372,7 +372,7 @@ main (int argc, char *argv[]) events for the drawing area */ gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_ALL); - GTK_WIDGET_SET_FLAGS (drawing_area, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (drawing_area, TRUE); gtk_widget_grab_focus (drawing_area); /* .. And create some buttons */