X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fgraphics%2FSurface.java;h=31ac36ea29da80b03fb668fa39ca45b18f3e8727;hb=c39caea88b8a157ddae4db454fe8736a9864ccd6;hp=b9207bb635ebda3c740c2b70b70300908776cf67;hpb=8e190fb0ff508ccf4962bbfbf8295a431805c12b;p=org.ibex.core.git diff --git a/src/org/ibex/graphics/Surface.java b/src/org/ibex/graphics/Surface.java index b9207bb..31ac36e 100644 --- a/src/org/ibex/graphics/Surface.java +++ b/src/org/ibex/graphics/Surface.java @@ -51,6 +51,7 @@ public abstract class Surface extends PixelBuffer implements Task { public int newmousey = -1; ///< y position of the mouse, in real time; this lets us collapse Move's public boolean minimized = false; ///< True iff this surface is minimized, in real time public boolean maximized = false; ///< True iff this surface is maximized, in real time + public boolean unrendered = true; ///< True iff this surface has not yet been rendered DirtyList dirtyRegions = new DirtyList(); ///< Dirty regions on the surface // Used For Simulating Clicks and DoubleClicks ///////////////////////////////////////////////// @@ -161,7 +162,7 @@ public abstract class Surface extends PixelBuffer implements Task { /** subclasses should invoke this method when the user resizes the window */ protected final void SizeChange(final int width, final int height) { - if (pendingWidth == width && pendingHeight == height) return; + if (unrendered || (pendingWidth == width && pendingHeight == height)) return; pendingWidth = width; pendingHeight = height; syncRootBoxToSurface = true; @@ -224,8 +225,19 @@ public abstract class Surface extends PixelBuffer implements Task { public Surface(Box root) { this.root = root; - root.setWidth(root.minwidth, Math.min(Platform.getScreenWidth(), root.maxwidth)); - root.setHeight(root.minheight, Math.min(Platform.getScreenHeight(), root.maxheight)); + // FIXME: document this in the reference + if (!root.test(root.HSHRINK) && root.maxwidth == Integer.MAX_VALUE) + root.maxwidth = Platform.getScreenWidth() / 2; + if (!root.test(root.VSHRINK) && root.maxheight == Integer.MAX_VALUE) + root.maxheight = Platform.getScreenHeight() / 2; + root.setWidth(root.minwidth, + root.test(root.HSHRINK) + ? Math.max(root.minwidth, root.contentwidth) + : Math.min(Platform.getScreenWidth(), root.maxwidth)); + root.setHeight(root.minheight, + root.test(root.VSHRINK) + ? Math.max(root.minheight, root.contentheight) + : Math.min(Platform.getScreenHeight(), root.maxheight)); Surface old = fromBox(root); if (old != null) old.dispose(false); else root.removeSelf(); @@ -246,13 +258,15 @@ public abstract class Surface extends PixelBuffer implements Task { root.setHeight(root.minheight, pendingHeight); syncRootBoxToSurface = false; } - if (root.maxwidth != root.width || root.maxheight != root.height) { + int rootwidth = root.test(root.HSHRINK) ? root.contentwidth : root.maxwidth; + int rootheight = root.test(root.VSHRINK) ? root.contentheight : root.maxheight; + if (rootwidth != root.width || rootheight != root.height) { // dirty the place where the scar used to be and where it is now dirty(0, root.height - scarImage.height, scarImage.width, scarImage.height); - dirty(0, root.maxheight - scarImage.height, scarImage.width, scarImage.height); + dirty(0, rootheight - scarImage.height, scarImage.width, scarImage.height); } root.reflow(); - setSize(root.width, root.height); + setSize(rootwidth, rootheight); /*String oldcursor = cursor; cursor = "default"; root.putAndTriggerTrapsAndCatchExceptions("_Move", JS.T); @@ -282,6 +296,8 @@ public abstract class Surface extends PixelBuffer implements Task { return; } } + + unrendered = false; } // FEATURE: reinstate recycler