From 586bbc9b133709432526cdcc0719d4e483f0a403 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 25 Aug 2010 00:43:16 -0400 Subject: [PATCH] Make the initial focus in dialogs work as intended We had code that tried to prevent selecting the text in the label if we end up focusing a label, but it didn't take effect, because we were moving the focus into the label again afterwards. --- gtk/gtkdialog.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 01aec48ca8..1c070c2de3 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -419,25 +419,28 @@ gtk_dialog_map (GtkWidget *widget) { GList *children, *tmp_list; GtkWidget *first_focus = NULL; - - do - { - g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD); + + do + { + g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD); focus = gtk_window_get_focus (window); - if (first_focus == NULL) + if (first_focus == NULL) first_focus = focus; - else if (first_focus == focus) + else if (first_focus == focus) + { + if (GTK_IS_LABEL (focus) && + !gtk_label_get_current_uri (GTK_LABEL (focus))) + gtk_label_select_region (GTK_LABEL (focus), 0, 0); + break; + } + if (!GTK_IS_LABEL (focus)) break; - if (!GTK_IS_LABEL (focus)) - break; - if (!gtk_label_get_current_uri (GTK_LABEL (focus))) - gtk_label_select_region (GTK_LABEL (focus), 0, 0); - } + } while (TRUE); tmp_list = children = gtk_container_get_children (GTK_CONTAINER (priv->action_area)); - + while (tmp_list) { GtkWidget *child = tmp_list->data;