[gtk] popover menu: Add our own activate key bindings



commit c16f10abea9e7fe649b8bd3d7e9eb2b4c0daa7ea
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 12 16:55:43 2019 +0000

    popover menu: Add our own activate key bindings
    
    This solves issues with parent widgets, like combobox
    or entry, installing their own bindings for these
    keys, overriding the activation behavior that
    is implemented in gtkwindow.

 gtk/gtkpopovermenu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/gtk/gtkpopovermenu.c b/gtk/gtkpopovermenu.c
index 5b3fa927a1..93a0ba8953 100644
--- a/gtk/gtkpopovermenu.c
+++ b/gtk/gtkpopovermenu.c
@@ -381,6 +381,17 @@ gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
   add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
   add_tab_bindings (binding_set, GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
   add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Return, 0,
+                                "activate-default", 0);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_ISO_Enter, 0,
+                                "activate-default", 0);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Enter, 0,
+                                "activate-default", 0);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, 0,
+                                "activate-default", 0);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Space, 0,
+                                "activate-default", 0);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]