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.
This commit is contained in:
Franklin Wei
2024-07-21 04:49:06 -04:00
committed by Simon Tatham
parent 894115ad3d
commit 3f8ef29078
2 changed files with 10 additions and 8 deletions

View File

@ -1145,9 +1145,9 @@ the \c{button} parameter:
\dt \cw{MOD_CTRL}, \cw{MOD_SHFT}
\dd These indicate that the Control or Shift key was pressed
alongside the key. They only apply to the cursor keys, not to mouse
buttons or anything else.
\dd These indicate that the Control or Shift key was pressed alongside
the key. They only apply to the cursor keys and the ASCII horizontal
tab character \cw{\\t}, not to mouse buttons or anything else.
\dt \cw{MOD_NUM_KEYPAD}

View File

@ -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')