2003/11/16 08:28:10
[org.ibex.core.git] / src / org / xwt / Surface.java
index 36c82ee..3a083cc 100644 (file)
@@ -24,13 +24,8 @@ public abstract class Surface extends PixelBuffer {
         
     // Static Data ////////////////////////////////////////////////////////////////////////////////
 
-    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;
+    private static Scheduler.Task lastMoveMessage = null;
 
     /** all instances of Surface which need to be refreshed by the Scheduler */
     public static Vec allSurfaces = new Vec();
@@ -89,9 +84,7 @@ public abstract class Surface extends PixelBuffer {
     private int platform_window_height = 0;
     protected final void setSize(int width, int height) {
         if (root.width != width || root.height != height) {
-            /*
             root.dirty(0, root.height - Main.scarImage.getHeight(), Main.scarImage.getWidth(), Main.scarImage.getHeight());
-            */
             root.width = Math.max(Main.scarImage.getWidth(), width);
             root.height = Math.max(Main.scarImage.getHeight(), height);
         }
@@ -113,7 +106,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);
-            Scheduler.add(new Message() { public void perform() {
+            Scheduler.add(new Scheduler.Task() { public void perform() {
                 Platform.clipboardReadEnabled = true;
                 root.putAndTriggerJSTraps("Press3", Boolean.TRUE);
                 Platform.clipboardReadEnabled = false;
@@ -153,7 +146,9 @@ public abstract class Surface extends PixelBuffer {
         else if (button == 3) new SimpleMessage("DoubleClick3", Boolean.TRUE, Box.whoIs(root, mousex, mousey));
     }
 
-    /** sends a KeyPressed message; subclasses should not add the C- or A- prefixes, nor should they capitalize alphabet characters */
+    /** Sends a KeyPressed message; subclasses should not add the C- or A- prefixes,
+     *  nor should they capitalize alphabet characters
+     */
     protected final void KeyPressed(String key) {
         if (key == null) return;
 
@@ -171,7 +166,7 @@ public abstract class Surface extends PixelBuffer {
     }
 
     // This is implemented as a private static class instead of an anonymous class to work around a GCJ bug
-    private class KMessage extends Message {
+    private class KMessage extends Scheduler.Task {
         String key = null;
         public KMessage(String k) { key = k; }
         public void perform() {
@@ -188,13 +183,14 @@ public abstract class Surface extends PixelBuffer {
 
     Vec keywatchers = new Vec();
 
-    /** sends a KeyReleased message; subclasses should not add the C- or A- prefixes, nor should they capitalize alphabet characters */
+    /** sends a KeyReleased message; subclasses should not add the C- or A- prefixes,
+     *  nor should they capitalize alphabet characters */
     protected final void KeyReleased(final String key) {
         if (key == null) return;
         if (key.toLowerCase().equals("alt")) alt = false;
         else if (key.toLowerCase().equals("control")) control = false;
         else if (key.toLowerCase().equals("shift")) shift = false;
-        Scheduler.add(new Message() { public void perform() {
+        Scheduler.add(new Scheduler.Task() { public void perform() {
             outer: for(int i=0; i<keywatchers.size(); i++) {
                 Box b = (Box)keywatchers.elementAt(i);
                 for(Box cur = b; cur != null; cur = cur.parent)
@@ -211,7 +207,7 @@ public abstract class Surface extends PixelBuffer {
      *  message), the subclass should use (-1,-1).
      */
     protected final void Move(final int newmousex, final int newmousey) {
-        Scheduler.add(lastMoveMessage = new Message() { public void perform() {
+        Scheduler.add(lastMoveMessage = new Scheduler.Task() { public void perform() {
             synchronized(Surface.this) {
 
                 // if move messages are arriving faster than we can process them, we just start ignoring them
@@ -236,7 +232,7 @@ public abstract class Surface extends PixelBuffer {
     }
 
     protected final void SizeChange(final int width, final int height) {
-        Scheduler.add(new Message() { public void perform() {
+        Scheduler.add(new Scheduler.Task() { public void perform() {
             if (width == root.width && height == root.height) return;
             root.set(root.REFLOW);
             platform_window_width = width;
@@ -247,7 +243,7 @@ public abstract class Surface extends PixelBuffer {
     }
 
     protected final void PosChange(final int x, final int y) {
-        Scheduler.add(new Message() { public void perform() {
+        Scheduler.add(new Scheduler.Task() { public void perform() {
             root.x = x;
             root.y = y;
             root.putAndTriggerJSTraps("PosChange", Boolean.TRUE);
@@ -362,7 +358,7 @@ public abstract class Surface extends PixelBuffer {
     }
 
     // FEATURE: reinstate recycler
-    public class SimpleMessage extends Message {
+    public class SimpleMessage extends Scheduler.Task {
         
         private Box boxContainingMouse;
         private Object value;