}
/** 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 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;
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_children();
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();