diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 02e5dd9317..3a70c9ca56 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -332,6 +332,18 @@ gtk_entry_grab_focus (GtkWidget *widget) gtk_widget_grab_focus (priv->text); } +static gboolean +gtk_entry_mnemonic_activate (GtkWidget *widget, + gboolean group_cycling) +{ + GtkEntry *entry = GTK_ENTRY (widget); + GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry); + + gtk_widget_grab_focus (priv->text); + + return TRUE; +} + static void gtk_entry_class_init (GtkEntryClass *class) { @@ -351,6 +363,7 @@ gtk_entry_class_init (GtkEntryClass *class) widget_class->query_tooltip = gtk_entry_query_tooltip; widget_class->direction_changed = gtk_entry_direction_changed; widget_class->grab_focus = gtk_entry_grab_focus; + widget_class->mnemonic_activate = gtk_entry_mnemonic_activate; quark_entry_completion = g_quark_from_static_string ("gtk-entry-completion-key"); diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c index 8b2a022e88..9a48bee547 100644 --- a/gtk/gtkpasswordentry.c +++ b/gtk/gtkpasswordentry.c @@ -226,6 +226,18 @@ gtk_password_entry_grab_focus (GtkWidget *widget) gtk_widget_grab_focus (priv->entry); } +static gboolean +gtk_password_entry_mnemonic_activate (GtkWidget *widget, + gboolean group_cycling) +{ + GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget); + GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry); + + gtk_widget_grab_focus (priv->entry); + + return TRUE; +} + static void gtk_password_entry_class_init (GtkPasswordEntryClass *klass) { @@ -242,6 +254,7 @@ gtk_password_entry_class_init (GtkPasswordEntryClass *klass) widget_class->size_allocate = gtk_password_entry_size_allocate; widget_class->get_accessible = gtk_password_entry_get_accessible; widget_class->grab_focus = gtk_password_entry_grab_focus; + widget_class->mnemonic_activate = gtk_password_entry_mnemonic_activate; gtk_editable_install_properties (object_class, 1); diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c index a227956e93..eeeb618df5 100644 --- a/gtk/gtksearchentry.c +++ b/gtk/gtksearchentry.c @@ -258,6 +258,18 @@ gtk_search_entry_grab_focus (GtkWidget *widget) gtk_text_grab_focus_without_selecting (GTK_TEXT (priv->entry)); } +static void +gtk_search_entry_mnemonic_activate (GtkWidget *widget, + gboolean group_cycling) +{ + GtkSearchEntry *entry = GTK_SEARCH_ENTRY (widget); + GtkSearchEntryPrivate *priv = gtk_search_entry_get_instance_private (entry); + + gtk_widget_grab_focus (priv->entry); + + return TRUE; +} + static void gtk_search_entry_class_init (GtkSearchEntryClass *klass) { @@ -273,6 +285,7 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass) widget_class->size_allocate = gtk_search_entry_size_allocate; widget_class->get_accessible = gtk_search_entry_get_accessible; widget_class->grab_focus = gtk_search_entry_grab_focus; + widget_class->mnemonic_activate = gtk_search_entry_mnemonic_activate; klass->stop_search = gtk_search_entry_stop_search; diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 2f99cf6a00..8e16faa837 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -304,6 +304,28 @@ G_DEFINE_TYPE_WITH_CODE (GtkSpinButton, gtk_spin_button, GTK_TYPE_WIDGET, "change-value", 1, \ GTK_TYPE_SCROLL_TYPE, scroll) + +static void +gtk_spin_button_grab_focus (GtkWidget *widget) +{ + GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget); + GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button); + + gtk_widget_grab_focus (priv->entry); +} + +static gboolean +gtk_spin_button_mnemonic_activate (GtkWidget *widget, + gboolean group_cycling) +{ + GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget); + GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button); + + gtk_widget_grab_focus (priv->entry); + + return TRUE; +} + static void gtk_spin_button_class_init (GtkSpinButtonClass *class) { @@ -321,6 +343,8 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) widget_class->size_allocate = gtk_spin_button_size_allocate; widget_class->grab_notify = gtk_spin_button_grab_notify; widget_class->state_flags_changed = gtk_spin_button_state_flags_changed; + widget_class->grab_focus = gtk_spin_button_grab_focus; + widget_class->mnemonic_activate = gtk_spin_button_mnemonic_activate; class->input = NULL; class->output = NULL;