Review: winex11.drv: Add workaround for 'phantom key' presence in X

Andrew Eikum aeikum at
Tue Aug 11 14:37:41 CDT 2009

A bug made itself present in VkKeyScan's handling of the less-than 
character on US (and other) keyboard layouts.  VkKeyScan('<') in Windows 
returns 0x1bc, which is VK_OEM_COMMA with the shift key flag set.  In 
Wine, VkKeyScan('<') returns 0xe2, which is VK_OEM_102, or the VK for 
the "infamous phantom key".

The root cause of this is X's XKeysymToKeycode returning the keycode for 
the phantom key instead of the keycode for the comma key when passed the 
keysym for '<' (XK_less).  This isn't incorrect on X's part, but 
inconvenient for Wine as most US keyboards don't have the <> key, but 
rather use the shifted comma key.

The attached patch adds a new field in the main_key_tab structure.  The 
new field indicates which keysym, if any, should be passed to 
XKeysymToKeycode instead of '<'.  I've filled this field in for every 
keyboard type already defined in keyboard.c.

Since winex11.drv is a pretty touchy part of Wine, I'm sending this 
patch to wine-devel for review.  I don't have the hardware or software 
setup to test other language inputs, and LoadKeyboardLayout is not 
implemented so I can't just test with VkKeyScanEx.  If you're using a 
foreign keyboard, especially one with a <> key, please test VkKeyScan's 
handling of the '<' character with this patch applied.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 369a97d821d15ae81d99c439612ce4b1c0c77aa6.diff
Type: text/x-patch
Size: 15846 bytes
Desc: not available
URL: <>

More information about the wine-devel mailing list