[kaffe] Bug Report with partial fix

Ross Martin hacker at ross.interwrx.com
Thu Oct 9 20:59:02 PDT 2003


Hi Guys,

I've been trying to get kaffe's appletviewer to work with RuneScape, 
which you can try as follows:

appletviewer 
"http://www.runescape.com/client.cgi&world=4&plugin=0&rand=66351490"

Kaffe without patches fails to even load the applet.  I've attached a 
patch that fixes kaffe/applet/AppletTag.java
and java/awt/ImageLoader.java to at least get it to the load stage and 
display some of the animations.

However, there is still a bug that I haven't yet figured out.  For some 
reason, the mouse clicks aren't
being translated to the correct position for the Panel containing the 
Applet.  As a result, you have to click
with the mouse 10-20 pixels too high to get the buttons to register.  
I'd like some help with this last
problem, if someone could be so kind.

I've tried running kaffe's AppletViewer.class using Sun's java, and this 
loaded the Applet fine and
produced the correct mouse translation.  So the problem isn't in the 
AppletViewer.  It's probably
somewhere in kaffe's behind-the-scenes mouse event dispatch code.  I 
only have a vague idea how
this is supposed to work, so I'm hoping someone else could either find 
the problem or help me
understand what is supposed to happen so I can better debug where it 
goes wrong.

I'm using kaffe version 1.1.2...

Ross


Here's the patch for the part I fixed so far.  Could someone with access 
please apply it?
(If you have any problem with it, send me an email and I'll send it 
directly to you as
an attachment.)  What it does:

Patch to AppletTag is so it treats ':' and '/' as normal alphabetic 
characters.  This is necessary
to get it to treat "http://xxx.yyy.zzz" as being a single token in its 
parser, which is necessary
for correct parsing of web addresses.

Patch to ImageLoader causes it to not start a new ImageFrameLoader for 
Image streams that
an ImageFrameLoader can't handle, but ImageLoader handles fine.

Patch begins:


diff -ru kaffe-1.1.2-orig/libraries/javalib/java/awt/ImageLoader.java 
kaffe-1.1.2/libraries/javalib/java/awt/ImageLoader.java
--- kaffe-1.1.2-orig/libraries/javalib/java/awt/ImageLoader.java    
2003-10-09 18:24:42.000000000 -0700
+++ kaffe-1.1.2/libraries/javalib/java/awt/ImageLoader.java    
2003-10-09 18:27:45.000000000 -0700
@@ -45,6 +45,9 @@
       // give native layer a chance to do alpha channel reduction
       if ( !(img.producer instanceof ImageNativeProducer) )
           Toolkit.imgComplete( img.nativeData, status);
+        img.stateChange( s, 0, 0, img.width, img.height);
+        img.producer.removeConsumer( this);   +        img = null;     
// we are done with it, prevent memory leaks
   }
   else if ( status == SINGLEFRAMEDONE ) {
       s = ImageObserver.FRAMEBITS;
@@ -52,20 +55,26 @@
       // This is a (indefinite) movie production - move it out of the 
way (in its own thread)
       // so that we can go on with useful work. Note that if our 
producer was a ImageNativeProducer,
       // the whole external image has been read in already (no IO 
required, anymore)
-        new ImageFrameLoader( img);
+
+        if ( img.producer instanceof ImageNativeProducer ) {
+          new ImageFrameLoader( img);
+          img.stateChange( s, 0, 0, img.width, img.height);
+          img.producer.removeConsumer( this);   +          img = 
null;     // we are done with it, prevent memory leaks
+        }
+        else {
+          img.stateChange( s, 0, 0, img.width, img.height);
+        }
   }
   else {
       if ( (status & IMAGEERROR) != 0 )       s |= ImageObserver.ERROR;
       if ( (status & IMAGEABORTED) != 0 )     s |= ImageObserver.ABORT;
+        img.stateChange( s, 0, 0, img.width, img.height);
+        img.producer.removeConsumer( this);   +        img = null;     
// we are done with it, prevent memory leaks
   }

-    img.stateChange( s, 0, 0, img.width, img.height);

-    // this has to be called *after* a optional ImageFrameLoader went 
into action, since
-    // the producer might decide to stop if it doesn't have another 
consumer
-    img.producer.removeConsumer( this);
-   -    img = null;     // we are done with it, prevent memory leaks
   if ( this == asyncLoader )
       notify();     // in case we had an async producer
}
diff -ru kaffe-1.1.2-orig/libraries/javalib/kaffe/applet/AppletTag.java 
kaffe-1.1.2/libraries/javalib/kaffe/applet/AppletTag.java
--- kaffe-1.1.2-orig/libraries/javalib/kaffe/applet/AppletTag.java    
2003-10-09 18:24:43.000000000 -0700
+++ kaffe-1.1.2/libraries/javalib/kaffe/applet/AppletTag.java    
2003-10-09 18:26:21.000000000 -0700
@@ -260,7 +260,8 @@
   int ttype;

   st.lowerCaseMode( true);
-    st.ordinaryChar('/');
+    st.wordChars('/', '/');
+    st.wordChars(':', ':');

   while ( (ttype = st.nextToken()) != st.TT_EOF ) {
       if ( ttype == '<' ) {






More information about the kaffe mailing list