2002/08/18 05:27:01
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:50:09 +0000 (06:50 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:50:09 +0000 (06:50 +0000)
darcs-hash:20040130065009-2ba56-71d4052c2a58fa53b722ffa0f53bda3f716dcaf1.gz

CHANGES
src/org/xwt/Box.java
src/org/xwt/SpecialBoxProperty.java
src/org/xwt/Surface.java

diff --git a/CHANGES b/CHANGES
index 9c48e7f..f5b7e60 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 16-Aug megacz AWT.java, Java12.java, Java14.java: fixed jdk1.4 bug
               with keypresses and frameless windows.
 
+16-Aug megacz XWT.java, SpecialBoxProperty.java: box.apply()
+
+17-Aug megacz Box.java, SpecialBoxProperty.java, Surface.java: code to
+              prevent engine from quitting when changing the last
+              remaining surface from a frame to a window or vice
+              versa.
+
 
 
index 86eb459..1a1f672 100644 (file)
@@ -1314,7 +1314,7 @@ public final class Box extends JSObject {
     /** remove this node from its parent; INVARIANT: whenever the parent of a node is changed, remove() gets called. */
     public void remove() {
         if (parent == null) {
-            if (surface != null) surface.dispose();
+            if (surface != null) surface.dispose(true);
             return;
         }
         Box oldparent = getParent();
index 6302f49..f9880bf 100644 (file)
@@ -573,7 +573,7 @@ class SpecialBoxProperty {
 
         specialBoxProperties.put("Close", new SpecialBoxProperty() {
                 public void put(Box b, Object value) {
-                    if (b.getParent() == null && b.surface != null) b.surface.dispose();
+                    if (b.getParent() == null && b.surface != null) b.surface.dispose(true);
                 }
             });
 
@@ -713,7 +713,7 @@ class SpecialBoxProperty {
                     if (Log.on) Log.log(this, "template " + templatename + " not found at " +
                                         Context.enter().interpreterSourceFile + ":" + Context.enter().interpreterLine);
                 } else {
-                    if (!ThreadMessage.suspendThread()) try {
+                    if (ThreadMessage.suspendThread()) try {
                         Function callback = args.length < 2 ? null : (Function)args[1];
                         t.apply(b, null, null, callback, 0, t.numUnits());
                     } finally {
index e59dfc6..5b2f205 100644 (file)
@@ -374,19 +374,22 @@ public abstract class Surface {
     }
 
     /** Indicates that the Surface is no longer needed */
-    public final void dispose() {
+    public final void dispose(boolean quitIfAllSurfacesGone) {
         if (root == null) return;
         if (Log.on) Log.log(this, "disposing " + this);
         allSurfaces.removeElement(this);
         _dispose();
 
         // quit when all windows are closed
-        if (allSurfaces.size() == 0) {
+        if (allSurfaces.size() == 0 && quitIfAllSurfacesGone) {
+            throw new Error();
+            /*
             if (Log.on) {
                 if (refreshableSurfaceWasCreated) Log.log(this, "exiting because last remaining surface was disposed");
                 else Log.log(this, "exiting because no surface was ever created");
             }
             Platform.exit();
+            */
         }
     }
 
@@ -400,8 +403,11 @@ public abstract class Surface {
         this.scarred = scarAllSurfacesFromNowOn;
         scarAllSurfacesFromNowOn = true;
         this.root = root;
-        if (root.surface != null && root.surface.root == root) root.surface.dispose();
-        root.remove();
+        if (root.surface != null && root.surface.root == root) {
+            root.surface.dispose(false);
+        } else {
+            root.remove();
+        }
         root.setSurface(this);
 
         // make sure the root is properly sized