[vte] widget: Disable more widget keybindings



commit 8ef03ce788def3a13cbf909be9ab52843e4c6e58
Author: Christian Persch <chpe gnome org>
Date:   Sat Apr 12 17:12:17 2014 +0200

    widget: Disable more widget keybindings
    
    Disable all of GtkWidget's keybindings except the ones for popup-menu.
    We do not want that either, but handling Shift-F10/MenuKey ourself will
    require new API to en/disable it, so defer that for now.
    
    This reverts commit 46b7464576141d69bd0dce16409141cfb26a8225, wontfixing
    bug https://bugzilla.gnome.org/show_bug.cgi?id=153265.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726438

 src/vte.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index a1dc1bf..572e063 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -4766,6 +4766,13 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
 
        terminal = VTE_TERMINAL(widget);
 
+        /* We do NOT want chain up to GtkWidget::key-press-event, since that would
+         * cause GtkWidget's keybindings to be handled and consumed. However we'll
+         * have to handle the one sane binding (Shift-F10 or MenuKey, to pop up the
+         * context menu) ourself, so for now we simply skip the offending keybinding
+         * in class_init.
+         */
+
        /* First, check if GtkWidget's behavior already does something with
         * this key. */
        if (GTK_WIDGET_CLASS(vte_terminal_parent_class)->key_press_event) {
@@ -11875,19 +11882,15 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                        FALSE,
                                        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-        /* Style properties */
-
-        /* Keybindings */
-       binding_set = gtk_binding_set_by_class(klass);
-
-       /* Bind Copy, Paste, Cut keys */
-       gtk_binding_entry_add_signal(binding_set, GDK_KEY_F16, 0, "copy-clipboard",0);
-       gtk_binding_entry_add_signal(binding_set, GDK_KEY_F18, 0, "paste-clipboard", 0);
-       gtk_binding_entry_add_signal(binding_set, GDK_KEY_F20, 0, "copy-clipboard",0);
-
-       /* Disable GTK's builtin handler for Ctrl+F1, see bug 726438 */
+       /* Disable GtkWidget's keybindings except for Shift-F10 and MenuKey
+         * which pop up the context menu.
+         */
        binding_set = gtk_binding_set_by_class(vte_terminal_parent_class);
        gtk_binding_entry_skip(binding_set, GDK_KEY_F1, GDK_CONTROL_MASK);
+       gtk_binding_entry_skip(binding_set, GDK_KEY_F1, GDK_SHIFT_MASK);
+       gtk_binding_entry_skip(binding_set, GDK_KEY_KP_F1, GDK_CONTROL_MASK);
+       gtk_binding_entry_skip(binding_set, GDK_KEY_KP_F1, GDK_SHIFT_MASK);
+
 
        process_timer = g_timer_new ();
 


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