From e4f164d9585d4e84de15061de6430d5c1c1a12ed Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 28 Feb 2021 11:50:05 +0100 Subject: keymap: handle shift+tab combos correctly, after consuming modifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shift+Tab is an odd bird in XKB; it produces a shifted variant of tab, ISO_Left_Tab, with Shift being a consumed modifier. From a terminal perspective, Tab and ISO_Left_Tab are the same key, with Shift+Tab generating ‘CSI Z’, and all other combos generating a ‘CSI 27;mods;9~’ escape. Before, when we didn’t filter out consumed modifiers, we could simply re-use the keymap for Tab when translating ISO_Left_Tab. This is no longer possible, since shift has been filtered out. As a result, Shift+Tab no longer generated ‘CSI Z’, but ‘\t’. I.e as if shift wasn’t being pressed. This patch adds a separate keymap table for ISO_Left_Tab. It’s MOD_ANY entry corresponds to Shift+Tab, and emits ‘CSI Z’. All its other entries *exclude* shift (since it has been consumed), *but*, the encoded modifier (in the escape sequences) *include* shift. --- input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 110bd378..bc28bbf2 100644 --- a/input.c +++ b/input.c @@ -770,8 +770,8 @@ keymap_data_for_sym(xkb_keysym_t sym, size_t *count) switch (sym) { case XKB_KEY_Escape: *count = ALEN(key_escape); return key_escape; case XKB_KEY_Return: *count = ALEN(key_return); return key_return; - case XKB_KEY_Tab: /* FALLTHROUGH */ - case XKB_KEY_ISO_Left_Tab: *count = ALEN(key_tab); return key_tab; + case XKB_KEY_ISO_Left_Tab: *count = ALEN(key_iso_left_tab); return key_iso_left_tab; + case XKB_KEY_Tab: *count = ALEN(key_tab); return key_tab; case XKB_KEY_BackSpace: *count = ALEN(key_backspace); return key_backspace; case XKB_KEY_Up: *count = ALEN(key_up); return key_up; case XKB_KEY_Down: *count = ALEN(key_down); return key_down; -- cgit v1.3