if (button == 1) new Message("_Press1", T, root);
else if (button == 2) new Message("_Press2", T, root);
else if (button == 3) {
- final Box who = root;
Scheduler.add(new Scheduler.Task() { public void perform() throws JSExn {
Platform.clipboardReadEnabled = true;
try {
}
/** we enqueue ourselves in the Scheduler when we have a Move message to deal with */
- public void perform() {
- if (mousex == newmousex && mousey == newmousey) return;
- int oldmousex = mousex; mousex = newmousex;
- int oldmousey = mousey; mousey = newmousey;
- String oldcursor = cursor; cursor = "default";
- // Root gets motion events outside itself (if trapped)
- if (!root.inside(oldmousex, oldmousey) && !root.inside(mousex, mousey) && (button1 || button2 || button3))
- root.putAndTriggerTrapsAndCatchExceptions("_Move", T);
- if (!cursor.equals(oldcursor)) syncCursor();
- }
+ private Scheduler.Task mover = new Scheduler.Task() {
+ public void perform() {
+ if (mousex == newmousex && mousey == newmousey) return;
+ int oldmousex = mousex; mousex = newmousex;
+ int oldmousey = mousey; mousey = newmousey;
+ String oldcursor = cursor; cursor = "default";
+ // FIXME: Root (ONLY) gets motion events outside itself (if trapped)
+ if (oldmousex != mousex || oldmousey != mousey)
+ root.putAndTriggerTrapsAndCatchExceptions("_Move", T);
+ if (!cursor.equals(oldcursor)) syncCursor();
+ } };
/**
* Notify Ibex that the mouse has moved. If the mouse leaves the
protected final void Move(final int newmousex, final int newmousey) {
this.newmousex = newmousex;
this.newmousey = newmousey;
- Scheduler.add(this);
+ Scheduler.add(mover);
}
+ protected final void HScroll(int pixels) { new Message("_HScroll", new Integer(pixels), root); }
+ protected final void VScroll(int pixels) { new Message("_VScroll", new Integer(pixels), root); }
+ protected final void HScroll(float lines) { new Message("_HScroll", new Float(lines), root); }
+ protected final void VScroll(float lines) { new Message("_VScroll", new Float(lines), root); }
+
/** 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;
protected final void Minimized(boolean b) { minimized = b; new Message("Minimized", b ? T : F, root); }
protected final void Maximized(boolean b) { maximized = b; new Message("Maximized", b ? T : F, root); }
protected final void Focused(boolean b) { new Message("Focused", b ? T : F, root); }
- public void Refresh() { Scheduler.add(new Scheduler.Task() { public void perform() { } }); }
+
+ private boolean scheduled = false;
+ public void Refresh() { if (!scheduled) Scheduler.add(this); scheduled = true; }
+ public void perform() { scheduled = false; Scheduler.renderAll(); }
public final void setMaximized(boolean b) { if (b != maximized) _setMaximized(maximized = b); }
public final void setMinimized(boolean b) { if (b != minimized) _setMinimized(minimized = b); }
/** runs the prerender() and render() pipelines in the root Box to regenerate the backbuffer, then blits it to the screen */
public synchronized void render() {
-
+ scheduled = false;
// make sure the root is properly sized
do {
abort = false;
- root.repack();
+ root.pack();
if (syncRootBoxToSurface) {
root.setMaxWidth(JS.N(pendingWidth));
root.setMaxHeight(JS.N(pendingHeight));
dirty(0, root.maxheight - Main.scarImage.height, Main.scarImage.width, Main.scarImage.height);
}
root.resize(root.x, root.y, root.maxwidth, root.maxheight);
- root.resize_children();
+ root.place();
setSize(root.width, root.height);
- String oldcursor = cursor;
+ /*String oldcursor = cursor;
cursor = "default";
root.putAndTriggerTrapsAndCatchExceptions("_Move", JS.T);
- if (!cursor.equals(oldcursor)) syncCursor();
+ if (!cursor.equals(oldcursor)) syncCursor();*/
} while(abort);
int[][] dirt = dirtyRegions.flush();
else if (value.toLowerCase().equals("control")) control = false;
else if (value.toLowerCase().equals("shift")) shift = false;
this.value = value;
+ } else if (name.equals("_HScroll") || name.equals("_VScroll")) {
+ // FIXME: technically points != pixels
+ if (value instanceof Integer)
+ value = new Float(((Integer)value).intValue() * root.fontSize());
}
try {
boxContainingMouse.putAndTriggerTrapsAndCatchExceptions(name, value);