From 48d92fa67c3d96d107f56ba32ff309912f9c731e Mon Sep 17 00:00:00 2001 From: Michael James Gratton Date: Wed, 25 Jan 2017 17:14:13 +1100 Subject: [PATCH] Let focus escape composer web view using Ctrl+Tab/Ctrl+Shift+Tab. * src/client/composer/composer-widget.vala: Let default keyboard shortcuts handle focus move. * ui/composer-web-view.js: Don't consume Tab presses with Crtl/Alt/Meta modifiers. --- src/client/composer/composer-widget.vala | 16 +--------------- ui/composer-web-view.js | 8 +++++++- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala index 5b81edef..f91e8387 100644 --- a/src/client/composer/composer-widget.vala +++ b/src/client/composer/composer-widget.vala @@ -2010,23 +2010,9 @@ public class ComposerWidget : Gtk.EventBox { return Gdk.EVENT_STOP; } - if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0) - return Gdk.EVENT_PROPAGATE; - if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) { - if (event.keyval == Gdk.Key.Tab) { - child_focus(Gtk.DirectionType.TAB_FORWARD); - return Gdk.EVENT_STOP; - } - if (event.keyval == Gdk.Key.ISO_Left_Tab) { - child_focus(Gtk.DirectionType.TAB_BACKWARD); - return Gdk.EVENT_STOP; - } - return Gdk.EVENT_PROPAGATE; - } - if (this.can_delete_quote) { this.can_delete_quote = false; - if (event.keyval == Gdk.Key.BackSpace) { + if (event.is_modifier == 0 && event.keyval == Gdk.Key.BackSpace) { this.editor.delete_quoted_message(); return Gdk.EVENT_STOP; } diff --git a/ui/composer-web-view.js b/ui/composer-web-view.js index 7ef4b936..026fc210 100644 --- a/ui/composer-web-view.js +++ b/ui/composer-web-view.js @@ -53,7 +53,13 @@ ComposerPageState.prototype = { this.messageBody = document.getElementById(ComposerPageState.BODY_ID); this.messageBody.addEventListener("keydown", function(e) { - if (e.keyCode == 9) { + // Should be using 'e.key == "Tab"' here, but that was + // only fixed in WK in Oct 2016 (WK Bug 36267). Migrate to + // that when we can rely on it being in WebKitGTK. + if (e.keyIdentifier == "U+0009" + && !e.ctrlKey + && !e.altKey + && !e.metaKey) { if (!e.shiftKey) { state.tabOut(); } else {