[gtk+] Make the initial focus in dialogs work as intended
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Make the initial focus in dialogs work as intended
- Date: Wed, 25 Aug 2010 04:45:05 +0000 (UTC)
commit 586bbc9b133709432526cdcc0719d4e483f0a403
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 25 00:43:16 2010 -0400
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 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index 01aec48..1c070c2 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]