Search code examples
windowsresourcesopen-sourcex11keycode

Resource containing mapping from Microsoft virtual key to Xlib keycode or keysym


I want to make a platform independent library and I need to translate Microsoft virtual key to Xlib keycode or keysym. One way of doing this is to make a dictionary or hashmap containing the translation from one keycode to the other.I was wondering if there is any resource online containing the mappin from Microsoft virtual key to Xlib keycode or any open source project that already translated one to the other.


Solution

  • Check out the Qt source code for QKeyEvent or at least the code that creates these objects; Qt contains a list of key bindings in the Qt::Key enum so at least it has a mapping from Windows, Mac and X to this enum. It is then a matter of matching keycodes between the two platforms with the enum as a common reference. It's a boring job, though :)