spiegel-keyman/common
Marc Durdin 50ffbb2722 fix(windows): osk: handle simulated left Control event when AltGr pressed
When a European layout is active, and the user presses AltGr, Windows
generates a simulated VK_LCONTROL event alongside the VK_RMENU event.
This was causing the OSK to show LCtrl as depressed alongside RAlt, so
the OSK would show the wrong modifier layer, which was unhelpful and
confusing to the end user.

It is possible to detect the simulated VK_LCONTROL in the WH_KEYBOARD_LL
hook, because the scan code generated is 0x21D, instead of 0x1D.
Warning: this is not a documented value. (But, this 0x21D scan code is
not passed to the WM_KEYDOWN event!) Therefore, we use Keyman's existing
kmnLowLevelKeyboardProc to pass modifier key events on to the visual
keyboard.

This patch handles only this specific scenario, by watching for that
specific scan code in the new handler in the UfrmOSKOnScreenKeyboard
module, together with some minor refactoring so that it fits neatly.

A future improvement would be to have all modifier key processing go
through this new handler, and eliminate the timer-based polling of the
keyboard. However, there is some additional risk around missing events,
leading to 'stuck modifiers'.

Fixes: #14890
Build-bot: skip release:windows
2025-10-08 14:32:40 +02:00
..
cpp fix(developer): changes to better align the code in u16ltrim and u16rtrim 2024-09-10 11:13:42 +01:00
include maint(common): consolidate builder scripts 2025-08-02 08:11:24 +10:00
linux maint(common): consolidate builder scripts 2025-08-02 08:11:24 +10:00
mac maint(common): consolidate builder scripts 2025-08-02 08:11:24 +10:00
resources feat(windows): store larger images and source file 2025-02-27 13:31:38 +10:00
schemas chore: cleanup kps.xsd version typos 2025-04-04 12:25:44 +07:00
test maint(resources): nest unit tests under parent block 2025-10-06 16:09:47 +02:00
tools maint(resources): nest unit tests under parent block 2025-10-06 16:09:47 +02:00
web refactor(web): cleanup in test scripts 2025-09-30 17:40:15 +02:00
windows fix(windows): osk: handle simulated left Control event when AltGr pressed 2025-10-08 14:32:40 +02:00
build.sh maint(common): consolidate builder scripts 2025-08-02 08:11:24 +10:00