<AWT Dev> RFR: JDK-8165232 XKeycodeToKeysym is deprecated and should be replaced with XkbKeycodeToKeysym
Alan Burlison
Alan.Burlison at oracle.com
Wed Sep 7 11:29:48 UTC 2016
On 06/09/2016 22:03, Alan Burlison wrote:
> Thanks for the detail, doing as you suggest and migrating all the
> references seems like the best approach as it shouldn't require any
> followup work in the future. I'll make the changes you've suggested,
> retest and post an updated webrev when I've done so.
Unfortunately there's a wrinkle. In most cases it's easy enough to just
replace calls to XKeycodeToKeysym() with XkbKeycodeToKeysym(), but
there's some code that can't be dealt with that simply:
http://hg.openjdk.java.net/jdk9/dev/jdk/file/60d7fbe25cd7/src/java.desktop/unix/classes/sun/awt/X11/keysym2ucs.h#l135
There are two functions, xkeycode2keysym_noxkb() and
xkeycode2keysym_xkb() the intent being that if the XKEYBOARD extension
is not available the deprecated XKeycodeToKeysym() function that we want
to remove is used, and if XKEYBOARD is present then an alternate
mechanism is used (but not XkbKeycodeToKeysym(), strangely enough).
In the case of xkeycode2keysym_noxkb() it makes no sense to simply
replace the call to XKeycodeToKeysym() with XkbKeycodeToKeysym() because
xkeycode2keysym_noxkb() will only be called in the first place if the
XKEYBOARD extension has not been loaded, and presumably a replacement
call to XkbKeycodeToKeysym() would fail.
This ripples outwards - which of the _noxkb or _xkb variants is to be
used is predicated on XToolkit.canUseXKBCalls(), that in turn uses the
awt_UseXKB_Calls variable which is initialised in XToolkit.tryXKB()
based on probing to see if there is a useable XKEYBOARD extension.
Toolkit.canUseXKBCalls() is used in multiple other places as well.
The issue is that replacing calls to the deprecated XKeycodeToKeysym()
function relies on XKEYBOARD always being loaded. Can that assumption be
made for all X11-supporting platforms that Java9 will run on? If not,
there doesn't seem to be any way to remove the use of the deprecated
XKeycodeToKeysym(), unless someone can suggest an alternative that
doesn't use XkbKeycodeToKeysym().
I also notice that many of the affected files also contain references to
the obsolete Xsun server which was removed in Solaris 11. As Java9 will
be Solaris11+ only, that code could be removed - should I log a bug to
that effect?
--
Alan Burlison
--
More information about the awt-dev
mailing list