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

Print this page

        

@@ -208,11 +208,10 @@
     protected CPlatformWindow owner;
     protected boolean visible = false; // visibility status from native perspective
     private boolean undecorated; // initialized in getInitialStyleBits()
     private Rectangle normalBounds = null; // not-null only for undecorated maximized windows
     private CPlatformResponder responder;
-    private volatile boolean zoomed = false; // from native perspective
 
     public CPlatformWindow() {
         super(0, true);
     }
 

@@ -229,11 +228,13 @@
         responder = createPlatformResponder();
         contentView = createContentView();
         contentView.initialize(peer, responder);
 
         final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L;
-        final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), ownerPtr, styleBits, 0, 0, 0, 0);
+        Rectangle bounds = _target.getBounds();
+        final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(),
+                ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height);
         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() {

@@ -464,19 +465,19 @@
 //        assert CThreading.assertEventQueue();
         nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
     }
 
     private boolean isMaximized() {
-        return undecorated ? this.normalBounds != null : zoomed;
+        return undecorated ? this.normalBounds != null
+                : CWrapper.NSWindow.isZoomed(getNSWindowPtr());
     }
 
     private void maximize() {
         if (peer == null || isMaximized()) {
             return;
         }
         if (!undecorated) {
-            zoomed = true;
             CWrapper.NSWindow.zoom(getNSWindowPtr());
         } else {
             deliverZoom(true);
 
             this.normalBounds = peer.getBounds();

@@ -494,11 +495,10 @@
     private void unmaximize() {
         if (!isMaximized()) {
             return;
         }
         if (!undecorated) {
-            zoomed = false;
             CWrapper.NSWindow.zoom(getNSWindowPtr());
         } else {
             deliverZoom(false);
 
             Rectangle toBounds = this.normalBounds;