2002/07/19 04:48:12
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:49:12 +0000 (06:49 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:49:12 +0000 (06:49 +0000)
darcs-hash:20040130064912-2ba56-d6578751e152f2c22e6ffe6162a333244e2b7285.gz

CHANGES
src/org/xwt/Surface.java

diff --git a/CHANGES b/CHANGES
index 977e686..d29928b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 
 18-Jul megacz Platform.java: never create or permit windows smaller
               than the scar.
+
+18-Jul megacz Surface.java: improved shift modifier handling,
+              prohibited windows smaller than scar.
+
index 7cecd62..3b9bbf0 100644 (file)
@@ -201,15 +201,15 @@ public abstract class Surface {
     protected final void KeyPressed(String key) {
         if (key == null) return;
 
-        if (key.equals("alt")) alt = true;
+        if (key.toLowerCase().endsWith("shift")) shift = true;
+        else if (shift) key = key.toUpperCase();
+
+        if (key.toLowerCase().equals("alt")) alt = true;
         else if (alt) key = "A-" + key;
 
-        if (key.endsWith("control")) control = true;
+        if (key.toLowerCase().endsWith("control")) control = true;
         else if (control) key = "C-" + key;
 
-        if (key.endsWith("shift")) shift = true;
-        else if (shift) key = key.toUpperCase();
-
         final String fkey = key;
         MessageQueue.add(new KMessage(key));
     }
@@ -233,9 +233,9 @@ public abstract class Surface {
     /** 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.equals("alt")) alt = false;
-        else if (key.equals("control")) control = false;
-        else if (key.equals("shift")) shift = false;
+        if (key.toLowerCase().equals("alt")) alt = false;
+        else if (key.toLowerCase().equals("control")) control = false;
+        else if (key.toLowerCase().equals("shift")) shift = false;
         MessageQueue.add(new Message() { public void perform() {
             outer: for(int i=0; i<keywatchers.size(); i++) {
                 Box b = (Box)keywatchers.elementAt(i);
@@ -357,6 +357,8 @@ public abstract class Surface {
 
     /** wrapper for setSize() which makes sure to dirty the place where the scar used to be */
     void _setSize(int width, int height) {
+        width = Math.max(width, scarPicture.getWidth());
+        height = Math.max(height, scarPicture.getHeight());
         dirty(hscar,
               root.size(1) - vscar - scarPicture.getHeight(),
               scarPicture.getWidth(), scarPicture.getHeight());