keycodes all off by one with GTK and $DISPLAY pointing to an R5 server

Russell Shaw rjshaw at
Fri Sep 16 19:36:34 PDT 2005

Kean Johnston wrote:
> Hi everyone,
> I am having a really difficult time understanding this problem.
> Here's what I do:
> On 6.8.2 server, I run both an R5 'xev' and the 6.8.2 'xev'.
> If I press the TAB key, in both cases I get keycode 23,
> keysym 0xff09, Tab. If I press the 'q' key I get keycode
> 24, keysym 0x71, q. Life is good.
> Now I repeat the test running on a X terminal, or on an
> old R5 server, and things fall apart. If I press the TAB
> key, I get keycode 22, keysym 0xff09, Tab. If I press the
> 'q' key I get keycode 23, keysym 0x71, q. Notice that the
> keycodes are all off-by-one, but teh keysyms are correct.
> This causes considerable problems for GTK apps, which
> seem to want to use the keycode, not the keysym. Thus,
> for example, in Mozilla, pressing the 'q' key yields a
> TAB for me. Not so useful that! Same with gvim.
> So, I have two questions really: Why is everything off-by-one,
> and why does GTK use the keycode, and not the keysym?
> Any help at all would be greatly appreciated.

Gtk should use XLookupString to convert the keycode to
keysym, because the mappings can vary between servers.
Looks like gtk needs fixing. I don't use gtk any more.

More information about the xorg mailing list