From 276a510b4b539b1bc83a07e9400fc44631cddf91 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 30 Oct 2014 17:02:45 -0700 Subject: [PATCH] radiobutton: don't consider hidden buttons in the group for focus When a GtkRadioButton has no focus, it will accept it when there is no other active button in its group. If the active button in the group is hidden, for example because the UI desires not to have a default option pre-selected, currently the focus will not be accepted, which is not desired behavior. This commit changes the code to only consider visible buttons in the group when checking whether another button is active. https://bugzilla.gnome.org/show_bug.cgi?id=739474 --- gtk/gtkradiobutton.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index 4e98dd90a2..e13062a4dc 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -743,7 +743,8 @@ gtk_radio_button_focus (GtkWidget *widget, tmp_slist = priv->group; while (tmp_slist) { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tmp_slist->data))) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tmp_slist->data)) && + gtk_widget_get_visible (tmp_slist->data)) selected_button = tmp_slist->data; tmp_slist = tmp_slist->next; }