public static boolean shift = false; ///< true iff the shift button is pressed down, in real time
public static boolean button1 = false; ///< true iff button 1 is depressed, in Scheduler-time
public static boolean button2 = false; ///< true iff button 2 is depressed, in Scheduler-time
- public static boolean button3 = false; ///< true iff button 3 is depressed, in Scheduler-time
+ public static boolean button3 = false; ///< true iff button 3 is depressed, in Scheduler-tiem
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
private DirtyList dirtyRegions = new DirtyList(); ///< Dirty regions on the *screen*
- private int width = 0; ///< The actual width of the surface
- private int height = 0; ///< The actual height of the surface
- public int getWidth() { return width; }
- public int getHeight() { return height; }
-
// Used For Simulating Clicks and DoubleClicks /////////////////////////////////////////////////
public abstract void setTitleBarText(String s); ///< Sets the surface's title bar text, if applicable
public abstract void setIcon(Picture i); ///< Sets the surface's title bar text, if applicable
public abstract void _dispose(); ///< Destroy the surface
-
-
- // Sizing /////////////////////////////////////////////////////////////////////////////////
-
- public void setLimits(int min_width, int min_height, int max_width, int max_height) { }
-
- public final void setWidth(int width) { setSize(width, this.height); }
- public final void setHeight(int height) { setSize(this.width, height); }
- public final void setSize(int width, int height) {
- if (this.width == width && this.height == height) return;
- this.width = Math.max(Main.scarImage.width, width);
- this.height = Math.max(Main.scarImage.height, height);
- _setSize(width, height);
- }
+ public void setLimits(int min_width, int min_height, int max_width, int max_height) { /* FIXME */ }
// Helper methods for subclasses ////////////////////////////////////////////////////////////
// FEATURE: can we avoid creating objects here?
protected final void SizeChange(final int width, final int height) {
- Scheduler.add(new Scheduler.Task() { public void perform() {
+ Scheduler.addAtFront(new Scheduler.Task() { public void perform() {
+ // dirty the place where the scar used to be
+ root.dirty(0, root.maxheight - Main.scarImage.height, Main.scarImage.width, Main.scarImage.height);
+ root.setMaxWidth(JS.N(width));
+ root.setMaxHeight(JS.N(height));
root.set(root.REFLOW);
- Surface.this.width = width;
- Surface.this.height = height;
}});
abort = true;
}
public Surface(Box root) {
this.root = root;
+ root.setMaxWidth(JS.N(Math.min(Platform.getScreenWidth(), root.maxwidth)));
+ root.setMaxHeight(JS.N(Math.min(Platform.getScreenHeight(), root.maxheight)));
Surface old = fromBox(root);
if (old != null) old.dispose(false);
else root.removeSelf();
/** runs the prerender() and render() pipelines in the root Box to regenerate the backbuffer, then blits it to the screen */
public synchronized void render() {
- // dirty the place where the scar used to be
- if (root.width != width || root.height != height)
+ // dirty the place where the scar used to be in case the root window size was programmatically changed
+ if (root.maxwidth != root.width || root.maxheight != root.height)
root.dirty(0, root.height - Main.scarImage.height, Main.scarImage.width, Main.scarImage.height);
// make sure the root is properly sized
do {
abort = false;
- root.reflow(width, height);
- setSize(width, height);
+ root.repack();
+ root.resize(root.x, root.y, root.maxwidth, root.maxheight);
+ root.resize_children();
+ _setSize(root.width, root.height);
String oldcursor = cursor;
cursor = "default";
root.Move(mousex, mousey, mousex, mousey);