From eccc076085e32ad7eb1d9fe3e460764ec1aff279 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 25 Jul 2002 16:12:46 +0000 Subject: [PATCH] [ Patch from Padraig O'Briain, #87904 ] Thu Jul 25 11:57:57 2002 Owen Taylor [ Patch from Padraig O'Briain, #87904 ] * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using g_signal new. * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): Always focus the widget, even when we are activating as well. --- ChangeLog | 12 ++++++++++++ ChangeLog.pre-2-10 | 12 ++++++++++++ ChangeLog.pre-2-2 | 12 ++++++++++++ ChangeLog.pre-2-4 | 12 ++++++++++++ ChangeLog.pre-2-6 | 12 ++++++++++++ ChangeLog.pre-2-8 | 12 ++++++++++++ gtk/gtktogglebutton.c | 21 +++++++++++++++++++++ gtk/gtkwidget.c | 2 +- 8 files changed, 94 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a42f584724..c1518410bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Thu Jul 25 11:57:57 2002 Owen Taylor + + [ Patch from Padraig O'Briain, #87904 ] + + * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - + use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using + g_signal new. + + * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): + Always focus the widget, even when we are activating + as well. + 2002-07-24 Havoc Pennington * gtk/gtktextview.c: Apply patch from Gustavo diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a42f584724..c1518410bc 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +Thu Jul 25 11:57:57 2002 Owen Taylor + + [ Patch from Padraig O'Briain, #87904 ] + + * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - + use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using + g_signal new. + + * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): + Always focus the widget, even when we are activating + as well. + 2002-07-24 Havoc Pennington * gtk/gtktextview.c: Apply patch from Gustavo diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a42f584724..c1518410bc 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +Thu Jul 25 11:57:57 2002 Owen Taylor + + [ Patch from Padraig O'Briain, #87904 ] + + * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - + use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using + g_signal new. + + * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): + Always focus the widget, even when we are activating + as well. + 2002-07-24 Havoc Pennington * gtk/gtktextview.c: Apply patch from Gustavo diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a42f584724..c1518410bc 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +Thu Jul 25 11:57:57 2002 Owen Taylor + + [ Patch from Padraig O'Briain, #87904 ] + + * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - + use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using + g_signal new. + + * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): + Always focus the widget, even when we are activating + as well. + 2002-07-24 Havoc Pennington * gtk/gtktextview.c: Apply patch from Gustavo diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a42f584724..c1518410bc 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +Thu Jul 25 11:57:57 2002 Owen Taylor + + [ Patch from Padraig O'Briain, #87904 ] + + * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - + use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using + g_signal new. + + * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): + Always focus the widget, even when we are activating + as well. + 2002-07-24 Havoc Pennington * gtk/gtktextview.c: Apply patch from Gustavo diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a42f584724..c1518410bc 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +Thu Jul 25 11:57:57 2002 Owen Taylor + + [ Patch from Padraig O'Briain, #87904 ] + + * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - + use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using + g_signal new. + + * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): + Always focus the widget, even when we are activating + as well. + 2002-07-24 Havoc Pennington * gtk/gtktextview.c: Apply patch from Gustavo diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 32409d5a8f..739fc5bc44 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -52,6 +52,8 @@ static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass); static void gtk_toggle_button_init (GtkToggleButton *toggle_button); static gint gtk_toggle_button_expose (GtkWidget *widget, GdkEventExpose *event); +static gboolean gtk_toggle_button_mnemonic_activate (GtkWidget *widget, + gboolean group_cycling); static void gtk_toggle_button_pressed (GtkButton *button); static void gtk_toggle_button_released (GtkButton *button); static void gtk_toggle_button_clicked (GtkButton *button); @@ -115,6 +117,7 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) gobject_class->get_property = gtk_toggle_button_get_property; widget_class->expose_event = gtk_toggle_button_expose; + widget_class->mnemonic_activate = gtk_toggle_button_mnemonic_activate; button_class->pressed = gtk_toggle_button_pressed; button_class->released = gtk_toggle_button_released; @@ -401,6 +404,24 @@ gtk_toggle_button_expose (GtkWidget *widget, return FALSE; } +static gboolean +gtk_toggle_button_mnemonic_activate (GtkWidget *widget, + gboolean group_cycling) +{ + /* + * We override the standard implementation in + * gtk_widget_real_mnemonic_activate() in order to focus the widget even + * if there is no mnemonic conflict. + */ + if (GTK_WIDGET_CAN_FOCUS (widget)) + gtk_widget_grab_focus (widget); + + if (!group_cycling) + gtk_widget_activate (widget); + + return TRUE; +} + static void gtk_toggle_button_pressed (GtkButton *button) { diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index a29e466cad..f48ddab268 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -631,7 +631,7 @@ gtk_widget_class_init (GtkWidgetClass *klass) widget_signals[MNEMONIC_ACTIVATE] = g_signal_new ("mnemonic_activate", GTK_CLASS_TYPE (object_class), - GTK_RUN_LAST, + G_SIGNAL_RUN_LAST, GTK_SIGNAL_OFFSET (GtkWidgetClass, mnemonic_activate), _gtk_boolean_handled_accumulator, NULL, _gtk_marshal_BOOLEAN__BOOLEAN,