User account creation filtered due to spam.

Bug 29246 - Toolkit.getLockingKeyState(int) not implemented
Summary: Toolkit.getLockingKeyState(int) not implemented
Alias: None
Product: classpath
Classification: Unclassified
Component: awt (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: 0.94
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2006-09-27 01:10 UTC by Cameron McCormack
Modified: 2007-01-03 23:19 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:

Patch to implement Toolkit.getLockingKeyState(int) for GTK+ peers. (2.10 KB, patch)
2006-09-27 01:16 UTC, Cameron McCormack
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack 2006-09-27 01:10:16 UTC
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.
Comment 1 Cameron McCormack 2006-09-27 01:16:16 UTC
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. :)
Comment 2 Cameron McCormack 2006-10-15 07:13:21 UTC
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...)
Comment 3 2007-01-03 22:51:26 UTC
Subject: Bug 29246

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Mark Wielaard <mark>	07/01/03 22:51:07

Modified files:
	.              : ChangeLog 
	java/awt       : 
	gnu/java/awt   : 
	native/jni/gtk-peer: gnu_java_awt_peer_gtk_GtkToolkit.c 
	include        : gnu_java_awt_peer_gtk_GtkToolkit.h 

Log message:
	2007-01-03  Cameron McCormack  <>
	       Fixes bug #29246
	       * java/awt/ (getLockingKeyState): Use AWTUtilities
	       isValidKey method. Throw UnsupportedOperationException on a valid
	       key (for which no locking state can be given).
	       * gnu/java/awt/ (isValidKey): New method.
	       * gnu/java/awt/peer/gtk/ (getLockingKeyState): New
	       * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
	       (Java_gnu_java_awt_peer_gtk_GtkToolkit_getLockState): New method.
	       * include/gnu_java_awt_peer_gtk_GtkToolkit.h: Regenerated.


Comment 4 Mark Wielaard 2007-01-03 23:19:35 UTC
Patch checked in