http://bugs.winehq.org/show_bug.cgi?id=26489
Summary: GetKeyState does not work correctly with toggle keys (VK_CAPITAL, VK_NUMLOCK, VK_SCROLL) Product: Wine Version: 1.3.16 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: user32 AssignedTo: wine-bugs@winehq.org ReportedBy: melekor@projectmagma.net
Created an attachment (id=33725) --> (http://bugs.winehq.org/attachment.cgi?id=33725) Tiny test program which demonstrates the problem (exe and C++ source)
The WINE implementation of GetKeyState does not follow the spec regarding "toggle keys" such as caps lock, num lock and scroll lock.
The documentation states: (about the return value) "If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled."
Instead, what WINE appears to do, is flip the low-order bit when a toggle-key is "un-toggled" (on=>off). When it is toggled (off=>on), the low order bit remains unaffected. This is obviously completely incorrect.
I have attached a demo app (zip file with exe with C++ source code) which shows the problem. When run on windows, it displays "CAPS ON" or "CAPS OFF" in sync with the little light on the keyboard. When run on WINE it does not stay in sync.
Tested on 1.2.2 and 1.3.16 on Ubuntu 10.10 Maverick Meerkat running in VirtualBox, host OS is Win7.