diff --git a/news.d/bugfix/1357.windows.md b/news.d/bugfix/1357.windows.md new file mode 100644 index 000000000..7cc78a791 --- /dev/null +++ b/news.d/bugfix/1357.windows.md @@ -0,0 +1 @@ +Do not consider extended scan codes in Windows keyboard capture. diff --git a/plover/oslayer/windows/keyboardcontrol.py b/plover/oslayer/windows/keyboardcontrol.py index 14067456d..8dddf8998 100644 --- a/plover/oslayer/windows/keyboardcontrol.py +++ b/plover/oslayer/windows/keyboardcontrol.py @@ -102,6 +102,11 @@ class INPUT(ctypes.Structure): INPUT_MOUSE = 0 INPUT_KEYBOARD = 1 +KF_EXTENDED = 0x0100 +LLKHF_EXTENDED = KF_EXTENDED >> 8 +LLKHF_LOWER_IL_INJECTED = 0x0002 +LLKHF_INJECTED = 0x0010 + # Process utils code code based on psutil implementation. @@ -318,7 +323,10 @@ def _run(self): passthrough_down_keys = set() def on_key(pressed, event): - if event.flags & 0x10: + if event.flags & LLKHF_EXTENDED: + return False + + if event.flags & LLKHF_INJECTED: # Ignore simulated events (e.g. from KeyboardEmulation). return False if event.vkCode in PASSTHROUGH_KEYS: