Bug 25732

Summary: XKeycodeToKeysym returns incorrect value
Product: xorg Reporter: Rafal Radulski <rrafal>
Component: Server/Input/XKBAssignee: Daniel Stone <daniel>
Status: RESOLVED NOTABUG QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: halsmit
Version: unspecified   
Hardware: x86 (IA32)   
OS: other   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Ouput from xkbcomp :0 -xkb out.xkb
none
Source code that recreates the bug. none

Description Rafal Radulski 2009-12-20 17:47:38 UTC
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.
Rafal
Comment 1 Sergey V. Udaltsov 2009-12-24 15:14:26 UTC
Please attach the output of xkbcomp :0 -xkb out.xkb
Comment 2 Rafal Radulski 2009-12-26 08:27:28 UTC
Created attachment 32297 [details]
Ouput from  xkbcomp :0 -xkb out.xkb
Comment 3 Rafal Radulski 2009-12-26 12:27:03 UTC
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
Comment 4 Dirk Wallenstein 2009-12-27 02:26:53 UTC
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.
Comment 5 Rafal Radulski 2009-12-27 10:04:07 UTC
Thank you very much. Your suggestion works perfectly.
Rafal

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.