Switched from raw input to low-level keyboard hook, with -W/--raw to optionally re-enable raw input (needed to debug, so the hook doesn't cause GDB to make system input unusably slow), fixes #4399.
This commit is contained in:
@@ -29,7 +29,9 @@
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
int keyboard_scan;
|
||||
uint16_t scancode_map[768] = { 0 };
|
||||
|
||||
int keyboard_scan;
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Windows: F8+F12 */
|
||||
@@ -386,3 +388,22 @@ keyboard_ismsexit(void)
|
||||
return ((recv_key_ui[key_prefix_1_1] || recv_key_ui[key_prefix_1_2]) &&
|
||||
(recv_key_ui[key_uncapture_1] || recv_key_ui[key_uncapture_2]));
|
||||
}
|
||||
|
||||
/* This is so we can disambiguate scan codes that would otherwise conflict and get
|
||||
passed on incorrectly. */
|
||||
uint16_t
|
||||
convert_scan_code(uint16_t scan_code)
|
||||
{
|
||||
if ((scan_code & 0xff00) == 0xe000)
|
||||
scan_code = (scan_code & 0xff) | 0x0100;
|
||||
|
||||
if (scan_code == 0xE11D)
|
||||
scan_code = 0x0100;
|
||||
/* E0 00 is sent by some USB keyboards for their special keys, as it is an
|
||||
invalid scan code (it has no untranslated set 2 equivalent), we mark it
|
||||
appropriately so it does not get passed through. */
|
||||
else if ((scan_code > 0x01FF) || (scan_code == 0x0100))
|
||||
scan_code = 0xFFFF;
|
||||
|
||||
return scan_code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user