From 3f8ef290786fbaf7b9ec200a2fd598eb324c6b0c Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 21 Jul 2024 04:49:06 -0400 Subject: midend_process_key: allow Shift+Tab to pass through to the backend. Previously, a button code of ('\t' | MOD_SHFT) from a frontend would have the MOD_SHFT flag stripped by midend_process_key, resulting in a bare '\t' passed to the backend. Now, this combination is allowed to pass through to the backend. This will be used in the keyboard interface to Untangle, which I'm about to add. --- midend.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'midend.c') diff --git a/midend.c b/midend.c index 34290cc..bcacfc2 100644 --- a/midend.c +++ b/midend.c @@ -1219,13 +1219,15 @@ int midend_process_key(midend *me, int x, int y, int button) /* Special handling to make CTRL+SHFT+Z into REDO. */ if ((button & (~MOD_MASK | MOD_SHFT)) == (MOD_SHFT | '\x1A')) button = UI_REDO; - /* interpret_move() expects CTRL and SHFT only on cursor keys. */ - if (!IS_CURSOR_MOVE(button & ~MOD_MASK)) { + /* interpret_move() expects CTRL and SHFT only on cursor keys, and + * TAB (added as of 7/2024 to support Untangle). */ + if (!IS_CURSOR_MOVE(STRIP_BUTTON_MODIFIERS(button))) { /* reject CTRL+anything odd */ - if ((button & MOD_CTRL) && (button & ~MOD_MASK) >= 0x20) + if ((button & MOD_CTRL) && STRIP_BUTTON_MODIFIERS(button) >= 0x20) return PKR_UNUSED; - /* otherwise strip them */ - button &= ~(MOD_CTRL | MOD_SHFT); + /* otherwise strip them, except for tab */ + if (STRIP_BUTTON_MODIFIERS(button) != '\t') + button &= ~(MOD_CTRL | MOD_SHFT); } /* interpret_move() expects NUM_KEYPAD only on numbers. */ if ((button & ~MOD_MASK) < '0' || (button & ~MOD_MASK) > '9') -- cgit v1.1