2002/08/07 03:27:46
[org.ibex.core.git] / src / org / xwt / Platform.java
index a7f0627..5406ea9 100644 (file)
@@ -34,7 +34,7 @@ public class Platform {
     static boolean alreadyDetectedProxy = false;
 
     /** the result of proxy autodetection */
-    static HTTP.ProxyInfo cachedProxyInfo = null;
+    static Proxy cachedProxyInfo = null;
 
     /** the current build */
     public static String build = "unknown";
@@ -201,7 +201,7 @@ public class Platform {
     }
 
     /** Returns null if XWT should always use direct connection; otherwise returns a ProxyInfo object with proxy settings */
-    protected synchronized HTTP.ProxyInfo _detectProxy() { return null; }
+    protected synchronized Proxy _detectProxy() { return null; }
 
     /** displays a platform-specific "open file" dialog and returns the chosen filename, or null if the user hit cancel */
     protected String _fileDialog(String suggestedFileName, boolean write) { return null; }
@@ -214,9 +214,13 @@ public class Platform {
         try {
             String os = System.getProperty("os.name").toLowerCase();
             Process p;
-            if (os.indexOf("windows 9") > -1) {
+            if (os.indexOf("windows 9") != -1 || os.indexOf("windows me") != -1) {
+                // hack -- jdk1.2/1.3 on Win32 pop open an ugly DOS box; 1.4 does not
+                if (platform.getClass().getName().endsWith("Java12")) return null;
                 p = Runtime.getRuntime().exec("command.com /c set");
-            } else if ( (os.indexOf("nt") > -1) || (os.indexOf("windows 2000") > -1) ) {
+            } else if (os.indexOf("windows") > -1) {
+                // hack -- jdk1.2/1.3 on Win32 pop open an ugly DOS box; 1.4 does not
+                if (platform.getClass().getName().endsWith("Java12")) return null;
                 p = Runtime.getRuntime().exec("cmd.exe /c set");
             } else {  
                 p = Runtime.getRuntime().exec("env");
@@ -225,7 +229,7 @@ public class Platform {
             String s;
             while ((s = br.readLine()) != null)
                 if (s.startsWith(key + "="))
-                    return s.substring(0, key.length() + 1);
+                    return s.substring(key.length() + 1);
         } catch (Exception e) {
             if (Log.on) Log.log(this, "Exception while reading from environment:");
             if (Log.on) Log.log(this, e);
@@ -351,8 +355,8 @@ public class Platform {
     public static Surface createSurface(Box b, boolean framed, boolean refreshable) {
         Surface ret = platform._createSurface(b, framed);
         ret.setInvisible(b.invisible);
-        b.set(Box.size, 0, b.size(0) == 0 ? 10 : b.size(0));
-        b.set(Box.size, 1, b.size(1) == 0 ? 10 : b.size(1));
+        b.set(Box.size, 0, b.size(0) < Surface.scarPicture.getWidth() ? Surface.scarPicture.getWidth() : b.size(0));
+        b.set(Box.size, 1, b.size(1) < Surface.scarPicture.getHeight() ? Surface.scarPicture.getHeight() : b.size(1));
 
         Object titlebar = b.get("titlebar", null, true);
         if (titlebar != null) ret.setTitleBarText(titlebar.toString());
@@ -376,24 +380,20 @@ public class Platform {
     }
 
     /** detects proxy settings */
-    public static synchronized HTTP.ProxyInfo detectProxy() {
+    public static synchronized Proxy detectProxy() {
 
         if (cachedProxyInfo != null) return cachedProxyInfo;
         if (alreadyDetectedProxy) return null;
         alreadyDetectedProxy = true;
 
         if (Log.on) Log.log(Platform.class, "attempting environment-variable DNS proxy detection");
-        cachedProxyInfo = HTTP.ProxyInfo.detectProxyViaManual();
+        cachedProxyInfo = Proxy.detectProxyViaManual();
         if (cachedProxyInfo != null) return cachedProxyInfo;
 
         if (Log.on) Log.log(Platform.class, "attempting " + platform.getClass().getName() + " proxy detection");
         cachedProxyInfo = platform._detectProxy();
         if (cachedProxyInfo != null) return cachedProxyInfo;
 
-        if (Log.on) Log.log(Platform.class, "attempting WPAD proxy detection");
-        cachedProxyInfo = HTTP.ProxyInfo.detectProxyViaWPAD();
-        if (cachedProxyInfo != null) return cachedProxyInfo;
-
         return cachedProxyInfo;
     }