The current implementation of keysym_to_keycode does not properly handle unused keycodes. The functions XkbKeySymsPtr and XkbKeyGroupWidth mislead it into believing it is reading a keysym associated with the unused keycode when in reality it is reading a keysym associated with the *next used* keycode.
This impacts different keys depending on the keyboard layout in use. On mine for instance, the left Super key is unusable because its keycode is preceeded by an unused keycode. To resolve this issue, we take a page from XKeysymToKeycode and use the function XKeycodeToKeysym instead of manually accessing the keysyms. https://sourceforge.net/tracker/?func=detail&aid=3555424&group_id=69596&atid=525124 Reported-by: alexmaret Signed-off-by: Jason Gerecke <killert...@gmail.com> --- tools/xsetwacom.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index aac8b7d..aea2243 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -1012,18 +1012,17 @@ static int keysym_to_keycode(Display *dpy, KeySym sym) for (kc = xkb->min_key_code; kc <= xkb->max_key_code; kc++) { - KeySym* ks; int i; - ks = XkbKeySymsPtr(xkb, kc); for (i = 0; i < XkbKeyGroupWidth(xkb, kc, state.group); i++) - if (ks[i] == sym) + if (XKeycodeToKeysym(dpy, kc, i) == sym) goto out; } out: return kc; } + /* Map gibberish like "ctrl alt f2" into the matching AC_KEY values. Returns 1 on success or 0 otherwise. -- 1.7.12 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel