Bug 5349 - XKeycodeToKeysym should be listed as deprecated in the man page (and probably _X_DEPRECATED)
Summary: XKeycodeToKeysym should be listed as deprecated in the man page (and probably...
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: 6.8.2
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard: 2011BRB_Reviewed
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-16 06:54 UTC by paurea
Modified: 2019-05-23 18:11 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Fisrt testcase using XKeycodeToKeysym function (341 bytes, text/x-csrc)
2010-02-01 11:59 UTC, Alex
no flags Details
Second testcase using XGetKeyboardMapping function (356 bytes, text/x-csrc)
2010-02-01 12:03 UTC, Alex
no flags Details

Description paurea 2005-12-16 06:54:37 UTC
XKeycodeToKeysym gives different result than XGetKeyboardMapping, apparently
the Alt_Gr symbols dont appear in XKeycodeToKeysym. I am usign version
6.8.2.dfsg.1-9
in debian. If needed, I can provide code and more explanation. The same
program works perfectly in XFree86 v4 and in Xvnc.
Comment 1 Daniel Stone 2007-02-27 01:29:23 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 Alex 2010-02-01 11:57:56 UTC
I can confirm this bug with the following testcases.
It leads to a bug in winehq (see http://forum.winehq.org/viewtopic.php?t=7533)
Comment 3 Alex 2010-02-01 11:59:29 UTC
Created attachment 32974 [details]
Fisrt testcase using XKeycodeToKeysym function

Running this one gives you the following output :

0 22
1 33
2 22
3 33
4 FE55
5 0
6 FE55
7 0
8 33
Comment 4 Alex 2010-02-01 12:03:28 UTC
Created attachment 32975 [details]
Second testcase using XGetKeyboardMapping function

Here is the output of the second testcase :

0 22
1 33
2 22
3 33
4 23
5 FE55
6 23
7 FE55
8 22


Please note the '23' which is the value we were looking for using XKeycodeToKeysym.
And that's causing the bug in winehq.
Comment 5 Dirk Wallenstein 2010-02-02 03:45:28 UTC
You have to use XkbKeycodeToKeysym instead of XKeycodeToKeysym. 
bug 25732, comment 4

Sorry for the brevity. A cold still sometimes demands its share of my day, and
you want the answer now, right?
Comment 6 Alex 2010-02-02 04:05:53 UTC
So it's not a bug, just a deprecated function, isn't it ?
In this case, please update the man page or someone could have the same issue.
Comment 7 Dirk Wallenstein 2011-10-09 03:52:23 UTC
A little note to use the Xkb version has been added to the man page, but maybe more deprecation would be useful.
Comment 8 Dirk Wallenstein 2011-10-09 03:57:43 UTC
However, the man page has been updated.  Reopen if you think the note should be bigger.
Comment 9 Jeremy Huddleston Sequoia 2011-10-10 14:14:16 UTC
commit f2651e03f3295a453a2965c3749bc8b6e66f1c09
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Mon Oct 10 14:09:17 2011 -0700

    Mark XKeycodeToKeysym as _X_DEPRECATED
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Comment 10 firk 2019-04-09 11:17:51 UTC
(In reply to Alex from comment #6)
> So it's not a bug, just a deprecated function, isn't it ?
> In this case, please update the man page or someone could have the same
> issue.

NO NO NO

It is a BUG that was in Xkb since beginning and NO ONE even tried to look at it (or fix it). Instead, someone started to spread nonsense like "it works wrong because it is deprecated".

Normally, Xkb's version of XKeycodeToKeysym planned to be a wrapper for XkbKeycodeToKeysym that returns all needed keysyms but in old-compatible order.

Due to a stupid bug, it always losses keysym that should be at index #4.

look at src/xkb/XKBBind.c, function XKeycodeToKeysym()

two occurences of this 

>                 return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index,
>                                          col - lastSym + 2);

should be

>                 return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index,
>                                          col - lastSym + 1);

and two occurences of this 

>                 return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index,
>                                          col - lastSym);

should be

>                 return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index,
>                                          col - lastSym - 1);
Comment 11 GitLab Migration User 2019-05-23 18:11:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/lib/libx11/issues/97.


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.