X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FX11.java;h=d84aa85f72380d59d3848df1dc55af769ac2fe33;hb=6ef77f074f6f6260a05e8017d0bdf8c9ef524cd3;hp=b51b1a63cfb4ae87c7d2b1f023144cdeb44ba271;hpb=30aa8aa58f30808651a02e089c84998d6e054cbb;p=org.ibex.core.git diff --git a/src/org/xwt/plat/X11.java b/src/org/xwt/plat/X11.java index b51b1a6..d84aa85 100644 --- a/src/org/xwt/plat/X11.java +++ b/src/org/xwt/plat/X11.java @@ -1,4 +1,4 @@ -// Copyright 2003 Adam Megacz, see the COPYING file for licensing [LGPL] +// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL] package org.xwt.plat; import gnu.gcj.RawData; @@ -6,6 +6,7 @@ import java.net.*; import java.lang.reflect.*; import java.io.*; import java.util.*; +import org.xwt.js.*; import org.xwt.util.*; import org.xwt.*; @@ -33,7 +34,7 @@ public class X11 extends POSIX { protected String _getAltKeyName() { return System.getProperty("os.name", "").indexOf("SunOS") != -1 ? "Meta" : "Alt"; } - protected Picture _createPicture() { return new X11Picture(); } + protected Picture _createPicture(JS r) { return new X11Picture(r); } protected PixelBuffer _createPixelBuffer(int w, int h, Surface owner) { return new X11PixelBuffer(w, h); } protected Surface _createSurface(Box b, boolean framed) { return new X11Surface(b, framed); } protected boolean _needsAutoClick() { return true; } @@ -46,7 +47,7 @@ public class X11 extends POSIX { private native void natInit(); public X11() { } - public void init() { + public void postInit() { natInit(); (new Thread() { public void run() { eventThread(); } }).start(); } @@ -76,7 +77,9 @@ public class X11 extends POSIX { public native void setLimits(int minw, int minh, int maxw, int maxh); public native void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); public native void dispatchEvent(gnu.gcj.RawData ev); - + public void setMinimumSize(int minx, int miny, boolean resizable) { + setLimits(minx, miny, resizable ? Short.MAX_VALUE : minx, resizable ? Short.MAX_VALUE : miny); + } public X11Surface(Box root, boolean framed) { super(root); this.framed = framed; @@ -97,15 +100,13 @@ public class X11 extends POSIX { */ public static class X11Picture extends Picture { - int width; - int height; - int[] data = null; public X11PixelBuffer doublebuf = null; public int getWidth() { return width; } public int getHeight() { return height; } boolean initialized = false; + public X11Picture(JS r) { super(r); } public void init() { if (initialized) return; initialized = true; @@ -174,7 +175,9 @@ public class X11 extends POSIX { cx2 = Math.min(dx + source.width, cx2); cy2 = Math.min(dy + source.height, cy2); if (cx1 >= cx2 || cy1 >= cy2) return; - slowDrawPicture(((Platform.DefaultGlyph)source).getPicture(), dx, dy, cx1, cy1, cx2, cy2, rgb, true); + X11Picture pic = (X11Picture)((Platform.DefaultGlyph)source).getPicture(); + pic.init(); + slowDrawPicture(pic, dx, dy, cx1, cy1, cx2, cy2, rgb, true); } public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) { cx1 = Math.max(dx, cx1);