X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FPlatform.java;h=00b00d2c8ea07bbc1bacbabd8cf9cca0e5e58d9e;hb=0b0673bbc7f06c5d5418d5ab7ad5961a464e2de0;hp=aa8be357dc75679e5ea0ae40728fd7fedef69227;hpb=745fb6aad79e10eb8c402b8fa6a591769c0fcdfb;p=org.ibex.core.git diff --git a/src/org/xwt/Platform.java b/src/org/xwt/Platform.java index aa8be35..00b00d2 100644 --- a/src/org/xwt/Platform.java +++ b/src/org/xwt/Platform.java @@ -34,7 +34,7 @@ public class Platform { static boolean alreadyDetectedProxy = false; /** the result of proxy autodetection */ - static HTTP.Proxy cachedProxyInfo = null; + static org.xwt.HTTP.Proxy cachedProxyInfo = null; /** the current build */ public static String build = "unknown"; @@ -66,10 +66,9 @@ public class Platform { else if (!version.startsWith("1.0") && !version.startsWith("1.1")) platform_class = "Java2"; /* - // Disable 2d hardware acceleration on Jaguar - if (os_name.equals("Mac OS X") && os_version.equals("10.2")) + // Disable 2d hardware acceleration on Jaguar + if (os_name.equals("Mac OS X") && os_version.startsWith("10.2")) System.setProperty("com.apple.hwaccel", "false"); */ - System.setProperty("com.apple.hwaccel", "false"); if (platform_class != null) { platform = (Platform)Class.forName("org.xwt.plat." + platform_class).newInstance(); @@ -133,16 +132,6 @@ public class Platform { return _createPicture(b2,w,h); } - /** creates a socket object */ - public static Socket getSocket(String host, int port, boolean ssl, boolean negotiate) throws IOException { - return platform._getSocket(host, port, ssl, negotiate); - } - protected Socket _getSocket(String host, int port, boolean ssl, boolean negotiate) throws IOException { - Socket ret = ssl ? new TinySSL(host, port, negotiate) : new Socket(java.net.InetAddress.getByName(host), port); - ret.setTcpNoDelay(true); - return ret; - } - /** should return true if it is safe to supress full-surface dirties immediately after a window resize */ public static boolean supressDirtyOnResize() { return platform._supressDirtyOnResize(); } protected boolean _supressDirtyOnResize() { return false; } @@ -167,10 +156,6 @@ public class Platform { public static int getScreenHeight() { return platform._getScreenHeight(); } protected int _getScreenHeight() { return 480; } - /** returns the maximum number of threads that the XWT engine can create without adversely affecting the host OS */ - public static int maxThreads() { return platform._maxThreads(); } - protected int _maxThreads() { return 25; } - /** used to notify the user of very serious failures; usually used when logging is not working or unavailable */ protected void _criticalAbort(String message) { System.exit(-1); } @@ -227,13 +212,8 @@ public class Platform { /** 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; } - public static String fileDialog(String suggestedFileName, boolean write) { - if (!ThreadMessage.suspendThread()) return null; - try { - return platform._fileDialog(suggestedFileName, write); - } finally { - ThreadMessage.resumeThread(); - } + public static String fileDialog(String suggestedFileName, boolean write) throws org.xwt.js.JS.Exn { + return platform._fileDialog(suggestedFileName, write); } /** default implementation is Eric Albert's BrowserLauncher.java */ @@ -281,16 +261,6 @@ public class Platform { Surface ret = platform._createSurface(b, framed); ret.setInvisible(false); - Object titlebar = b.get("titlebar", true); - if (titlebar != null) ret.setTitleBarText(titlebar.toString()); - - Object icon = b.get("icon", true); - if (icon != null && icon instanceof Res) { - Picture pic = Picture.fromRes((Res)icon); - if (pic != null) ret.setIcon(pic); - else if (Log.on) Log.log(Platform.class, "unable to load icon " + icon); - } - ret.setLimits(b.minwidth, b.minheight, b.maxwidth, b.maxheight); if (refreshable) { @@ -302,15 +272,15 @@ public class Platform { } /** detects proxy settings */ - protected synchronized HTTP.Proxy _detectProxy() { return null; } - public static synchronized HTTP.Proxy detectProxy() { + protected synchronized org.xwt.HTTP.Proxy _detectProxy() { return null; } + public static synchronized org.xwt.HTTP.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.Proxy.detectProxyViaManual(); + cachedProxyInfo = org.xwt.HTTP.Proxy.detectProxyViaManual(); if (cachedProxyInfo != null) return cachedProxyInfo; if (Log.on) Log.log(Platform.class, "attempting " + platform.getClass().getName() + " proxy detection"); @@ -319,6 +289,10 @@ public class Platform { return cachedProxyInfo; } + + /** returns a Scheduler instance; used to implement platform-specific schedulers */ + protected Scheduler _getScheduler() { return new Scheduler(); } + public static Scheduler getScheduler() { return platform._getScheduler(); } public static void running() { platform._running(); } public void _running() { new Semaphore().block(); }