Dalibor, Dalibor Topic wrote:
Thanks for your answer. It took me some time to figure out, but in the end the patch was really trivial (attached). The reason was that KeyEvt.dispatch() reused the current KeyEvt object for KEY_TYPED events right after issuing KEY_PRESSED.In the case above, I think patching kaffe would be better than working around bugs.
I've changed it so that it will create a new KeyEvt object. It will even re-use a cached object if caching is activated (it's off by default, see java.awt.Defaults.RecycleEvents).
Gzz (compiled against IBM's JDK so far) runs for me under Kaffe, now. Success! :-)
Thank you,
- Benja
Index: libraries/javalib/java/awt/KeyEvt.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/awt/KeyEvt.java,v
retrieving revision 1.6
diff -u -r1.6 KeyEvt.java
--- libraries/javalib/java/awt/KeyEvt.java 24 Jul 1999 00:56:12 -0000 1.6
+++ libraries/javalib/java/awt/KeyEvt.java 9 Jan 2003 22:52:17 -0000
@@ -39,9 +39,8 @@
if ( !consumed && !ShortcutHandler.handle( this) ) {
if ( keyChar != 0 ) { // printable key
if ( AWTEvent.keyTgt != null ) { // maybe
a fast finger pulled the keyTgt under our feet
- id = KEY_TYPED;
- keyCode = 0;
- AWTEvent.keyTgt.process( this);
+ KeyEvt typedEvt =
+getEvent((Component)source, KEY_TYPED, 0, keyChar, modifiers);
+ AWTEvent.keyTgt.process(typedEvt);
}
}
}
