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

Andrew Eikum aeikum at
Tue Aug 11 14:53:05 CDT 2009

Andrew Eikum wrote:
> 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.
> Thanks
> Andrew

Here also are some test cases to test with.  They are set up for my 
keyboard.  Your setup might expect VK_OEM_102 to be returned instead of 
VK_OEM_COMMA.  Modify as appropriate.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9d405d951646a528834063e9ab6265f5d87eb055.diff
Type: text/x-patch
Size: 1751 bytes
Desc: not available
URL: <>

More information about the wine-devel mailing list