JDK-5100701 : Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0,6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,linux_sun
  • CPU: x86
  • Submitted: 2004-09-11
  • Updated: 2016-06-01
  • Resolved: 2011-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b48Fixed
Related Reports
Duplicate :  
Relates :  
Description
Toolkit.getLockingKeyState() is supposed to return the ststus of CAPS Lock, Num Lock and Scroll lock keys when called with respect to those key codes. This is supported on Motif and works fine on Motif. But with XToolkit, this method is throwing an unsupported operation exception. Though this exception is documented, this behavior is not compatible with previous releases since XToolkit is the default toolkit on linux since tiger. This must be supported on XToolkit which otherwise would appear as a regression in linux on tiger.

This is reproducible with XToolkit on Linux and Solaris10. This is not reproducible on win32. This is not reproducible with JDK 1.4.2 on linux.

I have attached a sample test. Execute the sample test. You would see a frame with a button. Click on the button. If an UnsupportedOperationException is thrown, the bug is reproduced.

Comments
EVALUATION Actually, it doesn't work in Motif: the implementation is buggy. To make it work, one need to XQueryPointer() passing a window to that call, not XQueryKeymap() as in MToolkit code. XQueryKeymap reports an actually pressed state of all the keys, not the toggled state of the modifier. To fix this in XAWT, one need (1) determine a keysym by a java keycode for a locking key; (2) calculate an X keycode via XKeysymToKeycode; (3) fetch an array of modifier lists (8 x Max_keycode_number): that one may be prefetched and stored in Java structures if MappingNotify is properly processed which is not, presently; anyway, it would be safer to reread it on demand; (4) call XQueryPointer for an application window, if any, or for a root window; (5) compare a mask returned in the last argument with a value in array of modifier lists.
02-10-2008

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
14-09-2004

EVALUATION We should implement this in mustang ###@###.### 2004-09-13 Not implemented yet. ###@###.### 2004-09-13 ###@###.### 2004-09-13 Implement this in dolphin together with port of KanaLock sniffer (see webrev attached to 4360364). ###@###.### 2005-06-17 07:55:29 GMT
13-09-2004