[kaffe] Re-used event objects (again)
Benja Fallenstein
b.fallenstein at gmx.de
Thu Jan 9 15:01:02 PST 2003
Dalibor,
Dalibor Topic wrote:
> In the case above, I think patching kaffe would be
> better than working around bugs.
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.
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
-------------- next part --------------
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);
}
}
}
More information about the kaffe
mailing list