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

Print this page

        

@@ -470,10 +470,11 @@
     }
 
     @Override // PlatformWindow
     public void setBounds(int x, int y, int w, int h) {
         nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
+        checkZoom(false);
     }
 
     private boolean isMaximized() {
         return undecorated ? this.normalBounds != null
                 : CWrapper.NSWindow.isZoomed(getNSWindowPtr());

@@ -948,11 +949,11 @@
         responder.handleWindowFocusEvent(gained, oppositePeer);
     }
 
     protected void deliverMoveResizeEvent(int x, int y, int width, int height,
                                         boolean byUser) {
-        checkZoom();
+        checkZoom(true);
 
         final Rectangle oldB = nativeBounds;
         nativeBounds = new Rectangle(x, y, width, height);
         if (peer != null) {
             peer.notifyReshape(x, y, width, height);

@@ -980,16 +981,22 @@
         if (peer != null) {
             peer.notifyZoom(isZoomed);
         }
     }
 
-    private void checkZoom() {
-        if (target instanceof Frame && isVisible()) {
-            Frame targetFrame = (Frame)target;
-            if (targetFrame.getExtendedState() != Frame.MAXIMIZED_BOTH && isMaximized()) {
+    private void checkZoom(boolean mouseEvent) {
+
+        if(mouseEvent && !isVisible()){
+            return;
+        }
+
+        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 (mouseEvent && state == Frame.MAXIMIZED_BOTH && !isMaximized()) {
                 deliverZoom(false);
             }
         }
     }