[gtk/matthiasc/for-master] button: Add explicit key bindings for activation
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] button: Add explicit key bindings for activation
- Date: Sat, 18 Jul 2020 16:53:39 +0000 (UTC)
commit 7b76be53606fe909160d853e49bb1c41bfa93e71
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 18 12:51:18 2020 -0400
button: Add explicit key bindings for activation
We should not rely on GtkWindow to have global
"activate-default" key bindings that happen to
fall back to activating the focus widget. This is
unreliable, since the bubbling up from the button
to the toplevel may run across other widgets that
may want to use Enter for their own purpose, and
then the button loses out. By adding our own
key bindings, the button gets to handle it before
its ancestors.
This fixes check buttons in the inspector property
list not reacting to Enter despite having focus.
gtk/gtkbutton.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 8a0c084b52..2cb79cc483 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -294,6 +294,17 @@ gtk_button_class_init (GtkButtonClass *klass)
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_BUTTON_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("button"));
+
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_space, 0,
+ "activate", NULL);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Space, 0,
+ "activate", NULL);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_Return, 0,
+ "activate", NULL);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_ISO_Enter, 0,
+ "activate", NULL);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Enter, 0,
+ "activate", NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]