# 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
-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 \
-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
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;
}
}
- // fixme
public void putAndTriggerJSTraps(Object key, Object value) {
- put(key, value);
+ JSContext.invokeTrap(this, key, value);
}
/** update MOUSEINSIDE, check for Enter/Leave/Move */
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)
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;
} });
}
// 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;
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 {
" 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)
System.err.println("Usage: xwt [-s] [-v] [-l <port>/<url>] 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:<port>/<url>");
System.err.println("");
System.err.println("Source-location is one of the following:");
System.err.println(" - the path to an xwar file");
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++;
}
if (Log.on) for(int i=0; i<args.length; i++) Log.log(Main.class, "argument " + i + ": " + args[i]);
String initialTemplateName = args.length > startargs + 1 ? args[startargs + 1] : "main";
- initialTemplateName = initialTemplateName.replace('/', '.');
+ initialTemplateName = initialTemplateName.replace('.', '/');
origin = args[startargs];
Res rr;
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;
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;
}