X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FSurface.java;h=9f48b2c123d23bb0f9f522c31674e75d2aa47b4a;hb=6a96430e10e27fc1de5754cb5add705f929dd109;hp=c30a34b7681f97beb30988c47606f0ea044f09bc;hpb=16ea48d834626fb9815da2f7632c3633838fb790;p=org.ibex.core.git diff --git a/src/org/xwt/Surface.java b/src/org/xwt/Surface.java index c30a34b..9f48b2c 100644 --- a/src/org/xwt/Surface.java +++ b/src/org/xwt/Surface.java @@ -14,7 +14,7 @@ import java.util.*; * * Note that the members in the section 'state variables' are either * in real-time (the actual size/position/state), or in - * MessageQueue-time (the size/position/state at the time that the + * Scheduler-time (the size/position/state at the time that the * now-executing message was enqueued). This distinction is important. */ // FIXME: put the scar box back in @@ -25,10 +25,16 @@ public abstract class Surface extends PixelBuffer { // Static Data //////////////////////////////////////////////////////////////////////////////// + // FIXME + private abstract static class Message extends Scheduler.Task { + public abstract void perform(); + public Object call(Object arg) { perform(); return null; } + } + /**< the most recently enqueued Move message; used to throttle the message rate */ private static Message lastMoveMessage = null; - /** all instances of Surface which need to be refreshed by the MessageQueue */ + /** all instances of Surface which need to be refreshed by the Scheduler */ public static Vec allSurfaces = new Vec(); /** When set to true, render() should abort as soon as possible and restart the rendering process */ @@ -37,9 +43,9 @@ public abstract class Surface extends PixelBuffer { public static boolean alt = false; ///< true iff the alt button is pressed down, in real time public static boolean control = false; ///< true iff the control button is pressed down, in real time 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 MessageQueue-time - public static boolean button2 = false; ///< true iff button 2 is depressed, in MessageQueue-time - public static boolean button3 = false; ///< true iff button 3 is depressed, in MessageQueue-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 @@ -48,8 +54,8 @@ public abstract class Surface extends PixelBuffer { public Box root; /**< The Box at the root of this surface */ public String cursor = "default"; - public int mousex; ///< the x position of the mouse, relative to this Surface, in MessageQueue-time - public int mousey; ///< the y position of the mouse, relative to this Surface, in MessageQueue-time + public int mousex; ///< the x position of the mouse, relative to this Surface, in Scheduler-time + public int mousey; ///< the y position of the mouse, relative to this Surface, in Scheduler-time 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 @@ -103,7 +109,7 @@ public abstract class Surface extends PixelBuffer { else if (button == 2) new SimpleMessage("Press2", Boolean.TRUE, Box.whoIs(root, mousex, mousey)); else if (button == 3) { final Box who = Box.whoIs(root, mousex, mousey); - Message.Q.add(new Message() { public void perform() { + Scheduler.add(new Message() { public void perform() { Platform.clipboardReadEnabled = true; root.put("Press3", Boolean.TRUE); Platform.clipboardReadEnabled = false; @@ -157,11 +163,11 @@ public abstract class Surface extends PixelBuffer { else if (control) key = "C-" + key; final String fkey = key; - Message.Q.add(new KMessage(key)); + Scheduler.add(new KMessage(key)); } // This is implemented as a private static class instead of an anonymous class to work around a GCJ bug - private class KMessage implements Message { + private class KMessage extends Message { String key = null; public KMessage(String k) { key = k; } public void perform() { @@ -184,7 +190,7 @@ public abstract class Surface extends PixelBuffer { if (key.toLowerCase().equals("alt")) alt = false; else if (key.toLowerCase().equals("control")) control = false; else if (key.toLowerCase().equals("shift")) shift = false; - Message.Q.add(new Message() { public void perform() { + Scheduler.add(new Message() { public void perform() { /* FIXME outer: for(int i=0; i