The java.awt.Toolkit.getLockingKeyState(int) method is not implemented. The stub method also throws IllegalArgumentException when it should be throwing UnsupportedOperationException, for key codes that are valid KeyEvent.VK_* values but cannot have their locking state inspected.
This method is required for Batik's DOM UIEvents to function properly.
Created attachment 12334 [details]
Patch to implement Toolkit.getLockingKeyState(int) for GTK+ peers.
This patch fixes the exception throwing behaviour of Toolkit.getLockingKeyState and implements actual locking key state inspection for GTK+ peers in GtkToolkit.
One slightly dodgy thing is that the GDK_MOD1_MASK bit is checked for when the state of the Alt key is requested. Most of the time, this will be right, but under X this could be remapped. I guess some X specific code should be used to look up the modifier key mappings. (This would also have the benefit of exposing other locking keys, like Num, Kana, etc.)
It would be good if the VK_* #defines in gnu_java_awt_peer_gtk_GtkToolkit.c were separated out into a .h file so that they need not be duplicated in GtkToolkit.c.
Also, the patch is completely untested, since I've screwed up my installed VMs. It does compile, though. :)
Ok, I've tested this patch now and it works for me. My papers are in, so feel free to test/commit. :) (And bug 29014, too...)
Subject: Bug 29246
Module name: classpath
Changes by: Mark Wielaard <mark> 07/01/03 22:51:07
. : ChangeLog
java/awt : Toolkit.java
gnu/java/awt : AWTUtilities.java
include : gnu_java_awt_peer_gtk_GtkToolkit.h
2007-01-03 Cameron McCormack <email@example.com>
Fixes bug #29246
* java/awt/Toolkit.java (getLockingKeyState): Use AWTUtilities
isValidKey method. Throw UnsupportedOperationException on a valid
key (for which no locking state can be given).
* gnu/java/awt/AWTUtilities.java (isValidKey): New method.
* gnu/java/awt/peer/gtk/GtkToolkit.java (getLockingKeyState): New
(Java_gnu_java_awt_peer_gtk_GtkToolkit_getLockState): New method.
* include/gnu_java_awt_peer_gtk_GtkToolkit.h: Regenerated.
Patch checked in