diff --git a/ChangeLog b/ChangeLog index 8d43a5eef4..f47b2dde78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Mar 11 13:58:24 2004 Owen Taylor + + * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the + put-labels-into-the-standard-focus-chain patches + from bug #59707. + + * gtk/gtklabel.c (gtk_label_focus): Only put the + label in the tab chain when the control key is pressed. + 2004-03-11 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8d43a5eef4..f47b2dde78 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Thu Mar 11 13:58:24 2004 Owen Taylor + + * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the + put-labels-into-the-standard-focus-chain patches + from bug #59707. + + * gtk/gtklabel.c (gtk_label_focus): Only put the + label in the tab chain when the control key is pressed. + 2004-03-11 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 8d43a5eef4..f47b2dde78 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Thu Mar 11 13:58:24 2004 Owen Taylor + + * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the + put-labels-into-the-standard-focus-chain patches + from bug #59707. + + * gtk/gtklabel.c (gtk_label_focus): Only put the + label in the tab chain when the control key is pressed. + 2004-03-11 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 8d43a5eef4..f47b2dde78 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Thu Mar 11 13:58:24 2004 Owen Taylor + + * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the + put-labels-into-the-standard-focus-chain patches + from bug #59707. + + * gtk/gtklabel.c (gtk_label_focus): Only put the + label in the tab chain when the control key is pressed. + 2004-03-11 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 8d43a5eef4..f47b2dde78 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Thu Mar 11 13:58:24 2004 Owen Taylor + + * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the + put-labels-into-the-standard-focus-chain patches + from bug #59707. + + * gtk/gtklabel.c (gtk_label_focus): Only put the + label in the tab chain when the control key is pressed. + 2004-03-11 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 91cfa1c48a..ab5364a195 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -147,6 +147,8 @@ static gboolean gtk_label_mnemonic_activate (GtkWidget *widget, gboolean group_cycling); static void gtk_label_setup_mnemonic (GtkLabel *label, guint last_key); +static gboolean gtk_label_focus (GtkWidget *widget, + GtkDirectionType direction); /* For selectable lables: */ static void gtk_label_move_cursor (GtkLabel *label, @@ -248,6 +250,7 @@ gtk_label_class_init (GtkLabelClass *class) widget_class->hierarchy_changed = gtk_label_hierarchy_changed; widget_class->screen_changed = gtk_label_screen_changed; widget_class->mnemonic_activate = gtk_label_mnemonic_activate; + widget_class->focus = gtk_label_focus; class->move_cursor = gtk_label_move_cursor; class->copy_clipboard = gtk_label_copy_clipboard; @@ -2812,6 +2815,27 @@ gtk_label_get_use_underline (GtkLabel *label) return label->use_underline; } +static gboolean +gtk_label_focus (GtkWidget *widget, + GtkDirectionType direction) +{ + GtkLabel *label = GTK_LABEL (widget); + GdkEvent *event; + GdkModifierType state; + + /* We want to be in the tab chain only if we are selectable + * and the Control key is pressed + */ + if (label->select_info == NULL) + return FALSE; + + if (!gtk_get_current_event_state (&state)) + return FALSE; + + if (state & GDK_CONTROL_MASK) + return GTK_WIDGET_CLASS (parent_class)->focus (widget, direction); +} + /* Compute the X position for an offset that corresponds to the "more important * cursor position for that offset. We use this when trying to guess to which * end of the selection we should go to when the user hits the left or diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index 06a6ee187b..34a0844356 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -36,8 +36,6 @@ static void gtk_message_dialog_class_init (GtkMessageDialogClass *klass); static void gtk_message_dialog_init (GtkMessageDialog *dialog); - -static void gtk_message_dialog_map (GtkWidget *widget); static void gtk_message_dialog_style_set (GtkWidget *widget, GtkStyle *prev_style); @@ -99,7 +97,6 @@ gtk_message_dialog_class_init (GtkMessageDialogClass *class) parent_class = g_type_class_peek_parent (class); - widget_class->map = gtk_message_dialog_map; widget_class->style_set = gtk_message_dialog_style_set; gobject_class->set_property = gtk_message_dialog_set_property; @@ -515,44 +512,6 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog, g_object_notify (G_OBJECT (message_dialog), "buttons"); } -static void -gtk_message_dialog_map (GtkWidget *widget) -{ - GtkWindow *window; - - window = GTK_WINDOW (widget); - - /* If a default button has not been chosen, then the selectable label will get - * the focus. This looks bad, so give the focus to a button in this case. - */ - - if (!gtk_window_get_focus (window)) - { - GtkWidget *focus_widget; - - if (window->default_widget) - focus_widget = window->default_widget; - else - { - GList *children; - - children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (widget)->action_area)); - - if (children) - focus_widget = GTK_WIDGET (children->data); - else - focus_widget = NULL; - - g_list_free (children); - } - - if (focus_widget) - gtk_widget_grab_focus (focus_widget); - } - - GTK_WIDGET_CLASS (parent_class)->map (widget); -} - static void gtk_message_dialog_style_set (GtkWidget *widget, GtkStyle *prev_style)