I'm using Ubuntu 9.10 (upgraded from previous release). Using Ubuntu's menu System -> Preferences -> Keyboard, I selected Czechia layout. Then, when I run a program with a call to XKeycodeToKeysym(), I get incorrect return value.
I'm passing keycode 11. That is a key marked with "2" and "@". I'm getting the following returned: index 0 - keysym 492, 1 - 50, 2 - 50, 3 - 64. I'm expecting the following values: 0 - 492, 1 - 50, 2 - 64, 3 - ?. All numbers are in decimal.
I'm expecting at-sign (keysym=64) for index 2, and dead-caron for index 3.
When I type text with keyboard, everything works correctly. I can type "2" with shift, at-sign with right-alt, and dead-caron with both shift and right-alt.
Please, let me know if you need more information.
Please attach the output of xkbcomp :0 -xkb out.xkb
Created attachment 32297 [details]
Ouput from xkbcomp :0 -xkb out.xkb
Created attachment 32303 [details]
Source code that recreates the bug.
Output when keyboard is set to Czechia:
keycode=11, index=0 => keysym=492
keycode=11, index=1 => keysym=50
keycode=11, index=2 => keysym=50
keycode=11, index=3 => keysym=64
You have to use XkbKeycodeToKeysym (mind the Xkb prefix). XKeycodeToKeysym keeps compatibility with pre-Xkb and thus only sees 2 groups with 2 levels each. It wraps the index into the next group.
Thank you very much. Your suggestion works perfectly.