2002/05/16 04:24:03
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:47:19 +0000 (06:47 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:47:19 +0000 (06:47 +0000)
darcs-hash:20040130064719-2ba56-509dbaa2cf1461e8347d1172fed9bf3fd0f3c2d5.gz

CHANGES
src/org/xwt/Surface.java

diff --git a/CHANGES b/CHANGES
index 47be491..51f8674 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 15-May megacz SpecialBoxProperty.java: added required extra dirty()
               call, extra checking on textcolor.
 
+15-May megacz Surface.java: key presses/releases only go to visible
+              children, setLimits()
+
index e2e1883..d8b944d 100644 (file)
@@ -132,6 +132,9 @@ public abstract class Surface {
     /** Destroy the surface */
     public abstract void _dispose();
 
+    /** Notifies the surface that limits have been imposed on the surface's size */
+    public void setLimits(int min_width, int min_height, int max_width, int max_height) { }
+
 
     // Helper methods for subclasses ////////////////////////////////////////////////////////////
 
@@ -185,7 +188,7 @@ public abstract class Surface {
     /** 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;
-        
+
         if (key.equals("alt")) alt = true;
         else if (alt) key = "A-" + key;
 
@@ -205,8 +208,12 @@ public abstract class Surface {
         public KMessage(String k) { key = k; }
         public void perform() {
             if (key.equals("C-v") || key.equals("A-v")) Platform.clipboardReadEnabled = true;
-            for(int i=0; i<keywatchers.size(); i++)
-                ((Box)keywatchers.elementAt(i)).put("KeyPressed", null, key);
+            outer: for(int i=0; i<keywatchers.size(); i++) {
+                Box b = (Box)keywatchers.elementAt(i);
+                for(Box cur = b; cur != null; cur = cur.getParent())
+                    if (cur.invisible) continue outer;
+                b.put("KeyPressed", null, key);
+            }
             Platform.clipboardReadEnabled = false;
         }
     }
@@ -218,8 +225,12 @@ public abstract class Surface {
         else if (key.equals("control")) control = false;
         else if (key.equals("shift")) shift = false;
         MessageQueue.add(new Message() { public void perform() {
-            for(int i=0; i<keywatchers.size(); i++)
-                ((Box)keywatchers.elementAt(i)).put("KeyReleased", null, key);
+            outer: for(int i=0; i<keywatchers.size(); i++) {
+                Box b = (Box)keywatchers.elementAt(i);
+                for(Box cur = b; cur != null; cur = cur.getParent())
+                    if (cur.invisible) continue outer;
+                b.put("KeyReleased", null, key);
+            }
         }});
     }