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

Print this page




 460     public void setBounds(int x, int y, int w, int h) {
 461 //        assert CThreading.assertEventQueue();
 462         nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
 463     }
 464 
 465     private boolean isMaximized() {
 466         return undecorated ? this.normalBounds != null : zoomed;
 467     }
 468 
 469     private void maximize() {
 470         if (isMaximized()) {
 471             return;
 472         }
 473         if (!undecorated) {
 474             zoomed = true;
 475             CWrapper.NSWindow.zoom(getNSWindowPtr());
 476         } else {
 477             deliverZoom(true);
 478 
 479             this.normalBounds = peer.getBounds();
 480             long screen = CWrapper.NSWindow.screen(getNSWindowPtr());
 481             Rectangle toBounds = CWrapper.NSScreen.visibleFrame(screen).getBounds();
 482             // Flip the y coordinate
 483             Rectangle frame = CWrapper.NSScreen.frame(screen).getBounds();
 484             toBounds.y = frame.height - toBounds.y - toBounds.height;
 485             setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);

 486         }
 487     }
 488 
 489     private void unmaximize() {
 490         if (!isMaximized()) {
 491             return;
 492         }
 493         if (!undecorated) {
 494             zoomed = false;
 495             CWrapper.NSWindow.zoom(getNSWindowPtr());
 496         } else {
 497             deliverZoom(false);
 498 
 499             Rectangle toBounds = this.normalBounds;
 500             this.normalBounds = null;
 501             setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);
 502         }
 503     }
 504 
 505     private boolean isVisible() {


 731             CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
 732         }
 733 
 734         //This is a temporary workaround. Looks like after 7124236 will be fixed
 735         //the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
 736         SwingUtilities.invokeLater(new Runnable() {
 737             @Override
 738             public void run() {
 739                 invalidateShadow();
 740             }
 741         });
 742     }
 743 
 744     @Override
 745     public void enterFullScreenMode() {
 746         isFullScreenMode = true;
 747         contentView.enterFullScreenMode();
 748         // the move/size notification from the underlying system comes
 749         // but it contains a bounds smaller than the whole screen
 750         // and therefore we need to create the synthetic notifications
 751         Rectangle screenBounds;
 752         final long screenPtr = CWrapper.NSWindow.screen(getNSWindowPtr());
 753         try {
 754             screenBounds = CWrapper.NSScreen.frame(screenPtr).getBounds();
 755         } finally {
 756             CWrapper.NSObject.release(screenPtr);
 757         }
 758         peer.notifyReshape(screenBounds.x, screenBounds.y, screenBounds.width,
 759                            screenBounds.height);
 760     }
 761 
 762     @Override
 763     public void exitFullScreenMode() {
 764         contentView.exitFullScreenMode();
 765         isFullScreenMode = false;
 766     }
 767 
 768     @Override
 769     public void setWindowState(int windowState) {
 770         if (!peer.isVisible()) {
 771             // setVisible() applies the state
 772             return;
 773         }
 774 
 775         int prevWindowState = peer.getState();
 776         if (prevWindowState == windowState) return;
 777 




 460     public void setBounds(int x, int y, int w, int h) {
 461 //        assert CThreading.assertEventQueue();
 462         nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
 463     }
 464 
 465     private boolean isMaximized() {
 466         return undecorated ? this.normalBounds != null : zoomed;
 467     }
 468 
 469     private void maximize() {
 470         if (isMaximized()) {
 471             return;
 472         }
 473         if (!undecorated) {
 474             zoomed = true;
 475             CWrapper.NSWindow.zoom(getNSWindowPtr());
 476         } else {
 477             deliverZoom(true);
 478 
 479             this.normalBounds = peer.getBounds();
 480 
 481             Insets i =  ((CGraphicsDevice)getGraphicsDevice()).getScreenInsets();
 482             Rectangle toBounds = getPeer().getGraphicsConfiguration().getBounds();
 483             setBounds(toBounds.x + i.left,
 484                     toBounds.y + i.top,
 485                     toBounds.width - i.left - i.right,
 486                     toBounds.height - i.top - i.bottom);
 487         }
 488     }
 489 
 490     private void unmaximize() {
 491         if (!isMaximized()) {
 492             return;
 493         }
 494         if (!undecorated) {
 495             zoomed = false;
 496             CWrapper.NSWindow.zoom(getNSWindowPtr());
 497         } else {
 498             deliverZoom(false);
 499 
 500             Rectangle toBounds = this.normalBounds;
 501             this.normalBounds = null;
 502             setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);
 503         }
 504     }
 505 
 506     private boolean isVisible() {


 732             CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
 733         }
 734 
 735         //This is a temporary workaround. Looks like after 7124236 will be fixed
 736         //the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
 737         SwingUtilities.invokeLater(new Runnable() {
 738             @Override
 739             public void run() {
 740                 invalidateShadow();
 741             }
 742         });
 743     }
 744 
 745     @Override
 746     public void enterFullScreenMode() {
 747         isFullScreenMode = true;
 748         contentView.enterFullScreenMode();
 749         // the move/size notification from the underlying system comes
 750         // but it contains a bounds smaller than the whole screen
 751         // and therefore we need to create the synthetic notifications
 752         Rectangle screenBounds = getPeer().getGraphicsConfiguration().getBounds();






 753         peer.notifyReshape(screenBounds.x, screenBounds.y, screenBounds.width,
 754                            screenBounds.height);
 755     }
 756 
 757     @Override
 758     public void exitFullScreenMode() {
 759         contentView.exitFullScreenMode();
 760         isFullScreenMode = false;
 761     }
 762 
 763     @Override
 764     public void setWindowState(int windowState) {
 765         if (!peer.isVisible()) {
 766             // setVisible() applies the state
 767             return;
 768         }
 769 
 770         int prevWindowState = peer.getState();
 771         if (prevWindowState == windowState) return;
 772