From 7f5df8070a5551fe66abd11a589677e285ca62f8 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:41:28 +0000 Subject: [PATCH] 2003/11/16 08:28:09 darcs-hash:20040130074128-2ba56-cbd38fd5befaf1866bddb0ace0f6687432339060.gz --- Makefile | 13 +++++++------ src/org/xwt/Box.java | 38 ++++++++++++++++++++------------------ src/org/xwt/HTTP.java | 13 ++++++++++--- src/org/xwt/Main.java | 26 ++++++++------------------ 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index a461981..e057fbd 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ $(target_bin): build/$(platform)/org/xwt/plat/$(platform).cc.o upstream/jpeg-6b/ # Special treatment: # -builtin_src := $(shell find src/org/xwt/builtin -name '*.*') +builtin_src := $(shell find src/org/xwt/builtin -name '*.*' \! -name '*.xcf') build/res/fonts/vera: .download_vera-1.10 mkdir -p build/res/fonts/vera cd build/res/fonts/vera; ln -s ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/Vera.ttf @@ -193,14 +193,15 @@ build/res/freetype.mips: build/mips/org/xwt/translators/Freetype.c.o build/mips/ -Lbuild/mips \ -Lupstream/freetype-2.1.4/src/objs \ -o $@ \ - build/mips/org/xwt/translators/Freetype.c.o \ - --strip \ + $^ \ + -Wl,-s \ -lfreetype .install_libmspack-20030726:; make .install_libmspack-20030726_mips-unknown-elf target=mips-unknown-elf -build/res/libmspack.mips: .install_libmspack-20030726 build/mips/org/xwt/translators/MSPack.c.o build/mips/org/xwt/mips/crt0.c.o build/mips/org/xwt/mips/syscalls.c.o +build/res/libmspack.mips: build/mips/org/xwt/translators/MSPack.c.o build/mips/org/xwt/mips/crt0.c.o build/mips/org/xwt/mips/syscalls.c.o @echo -e "\n\033[1mlinking .o -> .mips: $@\033[0m" mkdir -p build/mips build/res + make .install_libmspack-20030726 upstream/install/bin/mips-unknown-elf-gcc \ -nostdlib \ --static \ @@ -210,8 +211,8 @@ build/res/libmspack.mips: .install_libmspack-20030726 build/mips/org/xwt/transla -Lupstream/libmspack-20030726/src/mspack \ -Lupstream/libmspack-20030726/build-mips-unknown-elf \ -o $@ \ - build/mips/org/xwt/translators/MSPack.c.o \ - --strip \ + $^ \ + -Wl,-s \ -lmspack diff --git a/src/org/xwt/Box.java b/src/org/xwt/Box.java index 3ac48d4..864d332 100644 --- a/src/org/xwt/Box.java +++ b/src/org/xwt/Box.java @@ -97,7 +97,7 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { private String text = null; private Font font = null; - private Picture texture; + private Picture.Holder texture; private short strokewidth = 1; private int fillcolor = 0x00000000; private int strokecolor = 0xFF000000; @@ -152,9 +152,8 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { } } - // fixme public void putAndTriggerJSTraps(Object key, Object value) { - put(key, value); + JSContext.invokeTrap(this, key, value); } /** update MOUSEINSIDE, check for Enter/Leave/Move */ @@ -334,10 +333,10 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { if ((fillcolor & 0xFF000000) != 0x00000000) buf.fillTrapezoid(globalx, globalx + width, globaly, globalx, globalx + width, globaly + height, fillcolor); - if (texture != null) - for(int x = globalx; x < cx2; x += texture.getWidth()) - for(int y = globaly; y < cy2; y += texture.getHeight()) - buf.drawPicture(texture, x, y, cx1, cy1, cx2, cy2); + if (texture != null && texture.picture != null) + for(int x = globalx; x < cx2; x += texture.picture.getWidth()) + for(int y = globaly; y < cy2; y += texture.picture.getHeight()) + buf.drawPicture(texture.picture, x, y, cx1, cy1, cx2, cy2); if (text != null && !text.equals("") && font != null) if (font.rasterizeGlyphs(text, buf, strokecolor, globalx, globaly, cx1, cy1, cx2, cy2, null) == -1) @@ -529,23 +528,26 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { if (value == null) return; if (value instanceof String) { // FIXME check double set - fillcolor = stringToColor((String)value); + int newfillcolor = stringToColor((String)value); + if (newfillcolor == fillcolor) return; + fillcolor = newfillcolor; + dirty(); + return; } if (!(value instanceof Res)) return; - Picture pic = Picture.fromRes((Res)value, null); - if (pic != null) { - texture = pic; - minwidth = texture.getWidth(); - minheight = texture.getHeight(); + texture = Picture.fromRes((Res)value, null); + if (texture != null) { + minwidth = texture.picture.getWidth(); + minheight = texture.picture.getHeight(); MARK_REFLOW; dirty(); - } else Picture.fromRes((Res)value, new Callback() { public Object call(Object arg) { - texture = (Picture)arg; - minwidth = texture.getWidth(); - minheight = texture.getHeight(); + return; + } + texture = Picture.fromRes((Res)value, new Scheduler.Task() { public void perform() { + minwidth = texture.picture.getWidth(); + minheight = texture.picture.getHeight(); Box b = Box.this; MARK_REFLOW_b; dirty(); - return null; } }); } diff --git a/src/org/xwt/HTTP.java b/src/org/xwt/HTTP.java index 2b42f97..f3ff183 100644 --- a/src/org/xwt/HTTP.java +++ b/src/org/xwt/HTTP.java @@ -188,11 +188,18 @@ public class HTTP { // Methods to attempt socket creation ///////////////////////////////////////////////////////////////// + private 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; + } + + /** Attempts a direct connection */ public Socket attemptDirect() { try { if (Log.verbose) Log.log(this, "attempting to create unproxied socket to " + host + ":" + port + (ssl ? " [ssl]" : "")); - return Platform.getSocket(host, port, ssl, true); + return getSocket(host, port, ssl, true); } catch (IOException e) { if (Log.on) Log.log(this, "exception in attemptDirect(): " + e); return null; @@ -204,7 +211,7 @@ public class HTTP { try { if (Log.verbose) Log.log(this, "attempting to create HTTP proxied socket using proxy " + proxyHost + ":" + proxyPort); - Socket sock = Platform.getSocket(proxyHost, proxyPort, ssl, false); + Socket sock = getSocket(proxyHost, proxyPort, ssl, false); if (!ssl) { if (!path.startsWith("http://")) path = "http://" + host + ":" + port + path; } else { @@ -240,7 +247,7 @@ public class HTTP { " proxied socket using proxy " + proxyHost + ":" + proxyPort); try { - Socket sock = Platform.getSocket(proxyHost, proxyPort, ssl, false); + Socket sock = getSocket(proxyHost, proxyPort, ssl, false); DataOutputStream dos = new DataOutputStream(sock.getOutputStream()); dos.writeByte(0x04); // SOCKSv4(a) diff --git a/src/org/xwt/Main.java b/src/org/xwt/Main.java index 1552c00..b725805 100644 --- a/src/org/xwt/Main.java +++ b/src/org/xwt/Main.java @@ -32,11 +32,7 @@ public class Main { System.err.println("Usage: xwt [-s] [-v] [-l /] source-location [initial-template]"); System.err.println(""); System.err.println("Options:"); - // FEATURE: reintroduce - //System.err.println(" -s show rendering activity with red rectangles"); System.err.println(" -v verbose logging"); - // FEATURE: reintroduce - //System.err.println(" -l serve logs via HTTP on 127.0.0.1:/"); System.err.println(""); System.err.println("Source-location is one of the following:"); System.err.println(" - the path to an xwar file"); @@ -53,7 +49,6 @@ public class Main { while (true) { if (startargs > args.length - 1) printUsage(); else if (args[startargs].equals("-v")) Log.verbose = true; - else if (args[startargs].equals("-l")) startargs++; else break; startargs++; } @@ -62,7 +57,7 @@ public class Main { if (Log.on) for(int i=0; i startargs + 1 ? args[startargs + 1] : "main"; - initialTemplateName = initialTemplateName.replace('/', '.'); + initialTemplateName = initialTemplateName.replace('.', '/'); origin = args[startargs]; Res rr; @@ -76,9 +71,6 @@ public class Main { 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('/', '\\'); - final String final_origin = origin; rr = new Res.File(origin); if (!new File(origin).isDirectory()) rr = new Res.Zip(rr); initialTemplate = initialTemplateName; @@ -88,17 +80,15 @@ public class Main { final XWT xwt = new XWT(rr); final Res final_rr = rr; - Picture.fromRes((Res)Main.builtin.get("org/xwt/builtin/scar.png"), new Callback() { - public Object call(Object arg) { - scarImage = (Picture)arg; - Scheduler.add(new Scheduler.Task() { public void perform() { - Template.getTemplate(((Res)final_rr.get(initialTemplate))).apply(new BoxTree(), xwt); - } }); - return null; - } }); + scarHolder = + Picture.fromRes((Res)Main.builtin.get("org/xwt/builtin/scar.png"), + new Scheduler.Task() { public void perform() { + scarImage = scarHolder.picture; + Template.getTemplate(((Res)final_rr.get(initialTemplate))).apply(new BoxTree(), xwt); + } }); new Thread() { public void run() { Scheduler.init(); } }.start(); Platform.running(); } - + static Picture.Holder scarHolder = null; } -- 1.7.10.4