From ab2a07d55dc872ebf31b79105143edbc645d3f52 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:39:50 +0000 Subject: [PATCH] 2003/10/20 01:41:21 darcs-hash:20040130073950-2ba56-7fb314a016392a3ef42fd700fed3a53a719caea7.gz --- Makefile | 6 ++++++ src/org/xwt/Box.java.pp | 12 +++++++++++- src/org/xwt/Main.java | 21 +++++++++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 7d356f5..61588b4 100644 --- a/Makefile +++ b/Makefile @@ -314,3 +314,9 @@ dist-private: echo echo "*** DONE ******************************************" + + +# this is for Adam; don't mess with it +test: JVM; /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Commands/java -jar build/JVM/xwt.jar http://www.xwt.org/demo.xwar + + diff --git a/src/org/xwt/Box.java.pp b/src/org/xwt/Box.java.pp index 32127af..9699421 100644 --- a/src/org/xwt/Box.java.pp +++ b/src/org/xwt/Box.java.pp @@ -931,6 +931,16 @@ public final class Box extends JS.Scope { static { specialBoxProperties.put("fill", new ColorBoxProperty() { + public void put(Box b, Object value) { + if (value != null && value instanceof Res) { + b.image = Picture.fromRes((Res)value); + b.minwidth = b.image.getWidth(); + b.minheight = b.image.getHeight(); + b.dirty(); + } else { + super.put(b, value); + } + } public int getColor(Box b) { return b.fillcolor; } public void putColor(Box b, int argb) { b.fillcolor = argb; } }); @@ -1156,7 +1166,7 @@ public final class Box extends JS.Scope { return new Integer(b.x); } public void put(Box b, Object value) { - if (!((b.flags & NOTPACKED_FLAG) != 0)) return; + if (!((b.flags & NOTPACKED_FLAG) != 0) && (b.parent != null || b.surface == null)) return; int x = stoi(value); if (x == b.x) return; b.dirty(); diff --git a/src/org/xwt/Main.java b/src/org/xwt/Main.java index 902cb92..8967902 100644 --- a/src/org/xwt/Main.java +++ b/src/org/xwt/Main.java @@ -60,35 +60,44 @@ public class Main { Platform.forceLoad(); if (Log.on) for(int i=0; i startargs + 1 ? args[startargs + 1] : "main"; initialTemplateName = initialTemplateName.replace('/', '.'); origin = args[startargs]; + final Res rr; + final String initialTemplate; + if (origin.startsWith("http://") || origin.startsWith("https://")) { originHost = origin.substring(origin.indexOf('/') + 2); originHost = originHost.substring(0, originHost.indexOf('/') == -1 ? originHost.length() : originHost.indexOf('/')); if (originHost.indexOf('@') != -1) originHost = originHost.substring(originHost.indexOf('@') + 1); originAddr = InetAddress.getByName(originHost); + rr = builtin; + initialTemplate = "org/xwt/builtin/splash.xwt"; } else { // HACK because MSIE turns \'s into /'s in file URLs... argh!! if (Platform.platform.getClass().getName().endsWith("Win32")) origin = origin.replace('/', '\\'); if (!new File(origin).isDirectory()) origin += "!"; origin = "file:" + origin; + rr = Res.stringToRes(origin, true); + initialTemplate = initialTemplateName; } - // FIXME put the splash screen back in if (Log.on) Log.log(Main.class, "loading xwar"); - - final Res rr = Res.stringToRes(origin, true); final XWT xwt = new XWT(rr); - final String initialTemplateName_ = initialTemplateName; new Thread(new Runnable() { public void run() { - Template.getTemplate(((Res)rr.get(initialTemplateName_)).addExtension(".xwt")).apply(new Box(), null, xwt); Message.Q.startQ(); + ThreadMessage.newthread(new JS.Callable() { + public Object call(JS.Array args) { + Template.getTemplate(((Res)rr.get(initialTemplate))).apply(new Box(), null, xwt); + return null; + } + }); } }).start(); -- 1.7.10.4