Patch for kjas (was: Java applets and ConfigureRequest)

Koos Vriezen koos.vriezen at xs4all.nl
Mon Jan 12 20:19:59 GMT 2004


On Mon, Dec 22, 2003 at 12:08:23PM +0100, Koos Vriezen wrote:
> I wrote:
> > Anyway, attached a patch that fixes the gray rectangle problem, simply by
> > calling 'frame.setUndecorated(true)'.
> 
> Arrgg, setUndecorated is since jdk 1.4 (see bug 70817). This means I should revert
> it and start playing with XConfigureWindow (which I could do for KJavaAppletWidget
> alone atm.) or we should finally give up on jdk 1.3.x (which also eliminates the JSSE
> issues).
> Anyone know a reason for keeping support for 1.3 (like no 1.4 available, or ..)?

I can somewhat keep 1.2/1.3 compatibility by checking the jvm version. Tested it
and it seems that jre-1.3 has no trouble with an undefined method as long as it
isn't called. 
It does mean however, that KJAS must be compiled with >= jdk1.4. And of course
the fix for mis-embedded applets doesn't work on 1.2/1.3 jdks.
Found another 1.4 only usage in KIOConnection with SocketTimeoutException,
changed that too.
Patch attached

> 
> Koos
-------------- next part --------------
? org/kde/kjas/server/.KJASAppletStub.java.swp
? org/kde/kjas/server/.KJASURLStreamHandlerFactory.java.swp
? org/kde/kjas/server/.Main.java.swp
? org/kde/kjas/server/remove_layers.diff
Index: org/kde/kjas/server/KJASAppletStub.java
===================================================================
RCS file: /home/kde/kdelibs/khtml/java/org/kde/kjas/server/KJASAppletStub.java,v
retrieving revision 1.51
diff -u -3 -p -r1.51 KJASAppletStub.java
--- org/kde/kjas/server/KJASAppletStub.java	4 Jan 2004 19:37:32 -0000	1.51
+++ org/kde/kjas/server/KJASAppletStub.java	12 Jan 2004 20:01:32 -0000
@@ -159,7 +159,8 @@ public final class KJASAppletStub
             }
         );
         frame.getContentPane().add( panel, BorderLayout.CENTER );
-        frame.setUndecorated(true);
+        if (Main.java_version >= 1.4)
+            frame.setUndecorated(true);
         frame.setLocation( 0, 0 );
         frame.pack();
         frame.setVisible(true);
Index: org/kde/kjas/server/KJASURLStreamHandlerFactory.java
===================================================================
RCS file: /home/kde/kdelibs/khtml/java/org/kde/kjas/server/KJASURLStreamHandlerFactory.java,v
retrieving revision 1.18
diff -u -3 -p -r1.18 KJASURLStreamHandlerFactory.java
--- org/kde/kjas/server/KJASURLStreamHandlerFactory.java	26 Dec 2003 20:54:22 -0000	1.18
+++ org/kde/kjas/server/KJASURLStreamHandlerFactory.java	12 Jan 2004 20:01:32 -0000
@@ -304,7 +304,7 @@ class KIOConnection
             throw new ConnectException("connection failed (not found)");
         }
         Main.debug ("KIO connect timeout " + url);
-        throw new SocketTimeoutException("connection failed (timeout)");
+        throw new IOException("connection failed (timeout)");
     }
     synchronized void disconnect() {
         if (connect_status == NOT_CONNECTED)
Index: org/kde/kjas/server/Main.java
===================================================================
RCS file: /home/kde/kdelibs/khtml/java/org/kde/kjas/server/Main.java,v
retrieving revision 1.36
diff -u -3 -p -r1.36 Main.java
--- org/kde/kjas/server/Main.java	31 Jul 2003 21:19:04 -0000	1.36
+++ org/kde/kjas/server/Main.java	12 Jan 2004 20:01:32 -0000
@@ -21,6 +21,7 @@ public class Main
     public  static final boolean             Debug;
     public  static final boolean             log;
     static final boolean                     cacheImages;
+    static float                             java_version = (float) 0.0;
     public static String                     proxyHost = null;
     public static int                        proxyPort = 0;
     private static boolean                   good_jdk = true;
@@ -56,7 +57,7 @@ public class Main
         }
         //Main.debug( "JVM numerical version = " + version );
         try {
-            float java_version = Float.parseFloat( version );
+            java_version = Float.parseFloat( version );
             if( java_version < 1.2 )
                 good_jdk = false;
         } catch( NumberFormatException e ) {


More information about the kfm-devel mailing list