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             CGraphicsDevice device = ((CGraphicsDevice)getGraphicsDevice());
 482             Insets i = device.getScreenInsets();
 483             Rectangle toBounds = device.getDefaultConfiguration().getBounds();
 484             setBounds(toBounds.x + i.left,
 485                     toBounds.y + i.top,
 486                     toBounds.width - i.left - i.right,
 487                     toBounds.height - i.top - i.bottom);
 488         }
 489     }
 490 
 491     private void unmaximize() {
 492         if (!isMaximized()) {
 493             return;
 494         }
 495         if (!undecorated) {
 496             zoomed = false;
 497             CWrapper.NSWindow.zoom(getNSWindowPtr());
 498         } else {
 499             deliverZoom(false);
 500 
 501             Rectangle toBounds = this.normalBounds;
 502             this.normalBounds = null;
 503             setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);
 504         }
 505     }
 506 
 507     private boolean isVisible() {


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






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