mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Further restrict the keys that can have MOD_NUM_KEYPAD
In all front ends other than JavaScript, and in JavaScript prior to my recent changes, MOD_NUM_KEYPAD can only be set on ASCII digits. For now, enforce this in midend_process_key() so as to avoid inconsistency between front ends. It might be useful to be able to distinguish keypad versions of more keys, but that should be co-ordinated across the code-base.
This commit is contained in:
4
midend.c
4
midend.c
@ -1182,8 +1182,8 @@ bool midend_process_key(midend *me, int x, int y, int button, bool *handled)
|
|||||||
/* interpret_move() expects CTRL and SHFT only on cursor keys. */
|
/* interpret_move() expects CTRL and SHFT only on cursor keys. */
|
||||||
if (!IS_CURSOR_MOVE(button & ~MOD_MASK))
|
if (!IS_CURSOR_MOVE(button & ~MOD_MASK))
|
||||||
button &= ~(MOD_CTRL | MOD_SHFT);
|
button &= ~(MOD_CTRL | MOD_SHFT);
|
||||||
/* ... and NUM_KEYPAD only on printable ASCII values. */
|
/* ... and NUM_KEYPAD only on numbers. */
|
||||||
if ((button & ~MOD_MASK) < 0x20 || (button & ~MOD_MASK) >= 0x80)
|
if ((button & ~MOD_MASK) < '0' || (button & ~MOD_MASK) > '9')
|
||||||
button &= ~MOD_NUM_KEYPAD;
|
button &= ~MOD_NUM_KEYPAD;
|
||||||
/*
|
/*
|
||||||
* Translate keyboard presses to cursor selection.
|
* Translate keyboard presses to cursor selection.
|
||||||
|
Reference in New Issue
Block a user