On Mon, May 18, 2009 at 2:34 AM, Peter Ĺstrand <email@example.com>
Sure, but that doesn't mean that they are usable.
On Sat, 16 May 2009, Marc-André Moreau wrote:
3) Once the keycode->virtual key code map is loaded, I use keycodes at run time and map them to virtual key codes,
then to scan codes. ANY X program receives the keycodes. Look in xwin.c.
The problem is just that you are using one mapping at build time (the XKB database) but another at runtime (the current Xserver keyboard mapping). This means that you cannot trust that the keycodes are the same: They can differ in a number of cases: When the used version of the XKB database differs, when you are running another platform at runtime (say, Solaris), when you move between "normal" and "evdev" systems, if you use Xvnc etc etc.
keycodes alone are unreliable as they are
hardware dependent, but that was the whole point of using the XKB *database* to map them a consistent naming system
(XKB key names / virtual key codes).
For a normal application, looking at the "keycode" is simply a big no-no.
Using the "keysyms" is the preferred approach; works on all platforms.