From 9dbcfa765ba59a8201425df18bec09c7bc334c5e Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 23 Feb 2023 22:32:53 +0000 Subject: More cleverness in midend_process_key() It now strips off modifier flags from keys that shouldn't have them and maps printable characters with MOD_CTRL to the corresponding control characters. It also catches Ctrl+Shift+Z because that obviously belongs in the midend. I've updated the JavaScript front-end to take advantage of these changes. Other front ends are unchanged and should work just as they did before. --- emcc.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'emcc.c') diff --git a/emcc.c b/emcc.c index 8037be4..eedfc35 100644 --- a/emcc.c +++ b/emcc.c @@ -408,19 +408,9 @@ bool key(int keycode, const char *key, const char *chr, int location, keyevent = keycode; if (keyevent >= 0) { - if (shift && (keyevent >= 0x100 && !IS_UI_FAKE_KEY(keyevent))) - keyevent |= MOD_SHFT; - - if (ctrl && !IS_UI_FAKE_KEY(keyevent)) { - if (keyevent >= 0x100) - keyevent |= MOD_CTRL; - else - keyevent &= 0x1F; - } - - if ('0' <= keyevent && keyevent <= '9' && - location == DOM_KEY_LOCATION_NUMPAD) - keyevent |= MOD_NUM_KEYPAD; + if (shift) keyevent |= MOD_SHFT; + if (ctrl) keyevent |= MOD_CTRL; + if (location == DOM_KEY_LOCATION_NUMPAD) keyevent |= MOD_NUM_KEYPAD; midend_process_key(me, 0, 0, keyevent, &handled); post_move(); -- cgit v1.1