src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java

Print this page

        

@@ -44,11 +44,12 @@
 import com.apple.laf.*;
 import com.apple.laf.ClientPropertyApplicator.Property;
 import com.sun.awt.AWTUtilities;
 
 public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
-    private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
+    private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr,
+            long styleBits, double x, double y, double w, double h, boolean zoomed);
     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
     private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
     private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h);
     private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH);

@@ -240,12 +241,13 @@
             // so we need to set a stub location to force an initial move/resize. Real bounds would be set later.
             bounds = new Rectangle(0, 0, 1, 1);
         } else {
             bounds = _peer.constrainBounds(_target.getBounds());
         }
+
         final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(),
-                ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height);
+                ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height, _peer.isMaximized());
         setPtr(nativeWindowPtr);
 
         if (target instanceof javax.swing.RootPaneContainer) {
             final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
             if (rootpane != null) rootpane.addPropertyChangeListener("ancestor", new PropertyChangeListener() {

@@ -981,15 +983,16 @@
             peer.notifyZoom(isZoomed);
         }
     }
 
     private void checkZoom() {
-        if (target instanceof Frame && isVisible()) {
-            Frame targetFrame = (Frame)target;
-            if (targetFrame.getExtendedState() != Frame.MAXIMIZED_BOTH && isMaximized()) {
+        if (target instanceof Frame) {
+            Frame targetFrame = (Frame) target;
+            int state = targetFrame.getExtendedState();
+            if (state != Frame.MAXIMIZED_BOTH && isMaximized()) {
                 deliverZoom(true);
-            } else if (targetFrame.getExtendedState() == Frame.MAXIMIZED_BOTH && !isMaximized()) {
+            } else if (state == Frame.MAXIMIZED_BOTH && !isMaximized()) {
                 deliverZoom(false);
             }
         }
     }