if (platform_class == null) {
if (Log.on) Log.log(Platform.class, "Unable to detect JVM");
- System.exit(-1);
+ new Platform().criticalAbort("Unable to detect JVM");
}
if (Log.on) Log.log(Platform.class, " platform = " + platform.getDescriptiveName());
} catch (Exception e) {
if (Log.on) Log.log(Platform.class, "Exception while trying to detect JVM");
if (Log.on) Log.log(Platform.class, e);
- System.exit(-1);
+ new Platform().criticalAbort("Unable to detect JVM");
}
}
/** creates a socket object */
protected Socket _getSocket(String host, int port, boolean ssl, boolean negotiate) throws IOException {
- return ssl ? new TinySSL(host, port, negotiate) : new Socket(java.net.InetAddress.getByName(host), port);
+ Socket ret = ssl ? new TinySSL(host, port, negotiate) : new Socket(java.net.InetAddress.getByName(host), port);
+ ret.setTcpNoDelay(true);
+ return ret;
}
/** creates and returns a picture */
}
/** quits XWT */
- protected void _exit() { System.exit(0); }
+ protected void _exit() {
+ if (Main.applet == null) {
+ System.exit(0);
+ } else {
+ // just block ourselves forever
+ // FIXME: implement this with an exit variable for MessageQueue and plat.*.eventThread
+ new Semaphore().block();
+ }
+ }
/** 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); }
+ protected void _criticalAbort(String message) { _exit(); }
/** used to notify the user of very serious failures; usually used when logging is not working or unavailable */
protected String _getDefaultFont() { return "sansserif10"; }
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, ret.width);
- b.set(Box.size, 1, ret.height);
+ 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));
Object titlebar = b.get("titlebar", null, true);
if (titlebar != null) ret.setTitleBarText(titlebar.toString());