94 KeySym *key_syms = XGetKeyboardMapping(display, keycode, index +
1,&num_syms);
I might be mis-reading the API but the docs as I read it have argument 3
as a count .. so it should be 1 here, should it not ?
https://tronche.com/gui/x/xlib/input/XGetKeyboardMapping.html
As written I have a suspicion you will at some point run into an X
BadValue error
The docs say :-
"In addition, the following expression must be less than or equal
to max_keycode as returned by XDisplayKeycodes():
first_keycode + keycode_count - 1
"
To be truly robust here we should somewhere obtain and probably cache
"first key code" and max_keycode.
https://tronche.com/gui/x/xlib/input/XDisplayKeycodes.html
I say cache since you don't want two X calls every time.
Then if the requested code is outside that ... just return NoSymbol I
suppose.
Furthermore
KeySym ks = key_syms[index];
then looks very wrong. You want "0" here .. not index, don't you?
So I must be completely misunderstanding this X API if this is working
for you.
I am also a bit unclear how we know that the first keysym listed for the
keycode from the list is the one we want ?
-phil.
On 9/14/16, 10:42 AM, Alan Burlison wrote:
On 06/09/2016 11:16, Alan Burlison wrote:
XKeycodeToKeysym is deprecated and when compiled on Solaris 12 with
warnings-as-errors this causes a compile time failure. References to
XKeycodeToKeysym should be replaced by XkbKeycodeToKeysym. As this is
common XOrg code it will affect Linux as well.
Bug: https://bugs.openjdk.java.net/browse/JDK-8165232
Webrev: http://cr.openjdk.java.net/~alanbur/JDK-8165232/
I've respun this and replaced the calls to XKeycodeToKeysym with
equivalent code that uses XGetKeyboardMapping instead. This addresses
the problem without introducing a dependency on XKEYBOARD, which I
think is is a better fix.
I'd appreciate any review comments.
Thanks,