// 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", "true");
if (platform_class != null) {
platform = (Platform)Class.forName("org.xwt.plat." + platform_class).newInstance();
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; }
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); }
/** 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) {
- // FIXME: put self in background
+ public static String fileDialog(String suggestedFileName, boolean write) throws org.xwt.js.JSExn {
return platform._fileDialog(suggestedFileName, write);
}
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) {
- /*
- FIXME
- 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) {
protected Scheduler _getScheduler() { return new Scheduler(); }
public static Scheduler getScheduler() { return platform._getScheduler(); }
- /** read an input stream into a byte array and invoke callback when ready */
- protected void _inputStreamToByteArray(final InputStream is, final Callback c) {
- new java.lang.Thread() {
- public void run() {
- try {
- final byte[] b = InputStreamToByteArray.convert(is);
- Scheduler.add(new Scheduler.Task() { public void perform() { c.call(b); }});
- } catch (IOException e) {
- Log.log(Platform.class, e);
- }
- }
- }.start();
- }
- public static void inputStreamToByteArray(InputStream is, Callback c) { platform._inputStreamToByteArray(is, c); }
-
public static void running() { platform._running(); }
public void _running() { new Semaphore().block(); }
}