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

Print this page


   1 /*
   2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 566                     CWrapper.NSWindow.makeKeyWindow(nsWindowPtr);
 567                 }
 568             } else {
 569                 CWrapper.NSWindow.orderOut(nsWindowPtr);
 570             }
 571         } else {
 572             // otherwise, put it in a proper z-order
 573             CWrapper.NSWindow.orderWindow(nsWindowPtr, CWrapper.NSWindow.NSWindowBelow,
 574                     ((CPlatformWindow)blocker.getPlatformWindow()).getNSWindowPtr());
 575         }
 576         this.visible = visible;
 577 
 578         // Manage the extended state when showing
 579         if (visible) {
 580             // Apply the extended state as expected in shared code
 581             if (target instanceof Frame) {
 582                 if (!wasMaximized && isMaximized()) {
 583                     // setVisible could have changed the native maximized state
 584                     deliverZoom(true);
 585                 } else {
 586                     switch (((Frame)target).getExtendedState()) {





 587                         case Frame.ICONIFIED:
 588                             CWrapper.NSWindow.miniaturize(nsWindowPtr);
 589                             break;
 590                         case Frame.MAXIMIZED_BOTH:
 591                             maximize();
 592                             break;
 593                         default: // NORMAL
 594                             unmaximize(); // in case it was maximized, otherwise this is a no-op
 595                             break;
 596                     }
 597                 }
 598             }
 599         }
 600 
 601         nativeSynthesizeMouseEnteredExitedEvents();
 602 
 603         // Configure stuff #2
 604         updateFocusabilityForAutoRequestFocus(true);
 605 
 606         // Manage parent-child relationship when showing


 767         nativeExitFullScreenMode(getNSWindowPtr());
 768         isFullScreenMode = false;
 769     }
 770 
 771     @Override
 772     public boolean isFullScreenMode() {
 773         return isFullScreenMode;
 774     }
 775 
 776     @Override
 777     public void setWindowState(int windowState) {
 778         if (peer == null || !peer.isVisible()) {
 779             // setVisible() applies the state
 780             return;
 781         }
 782 
 783         int prevWindowState = peer.getState();
 784         if (prevWindowState == windowState) return;
 785 
 786         final long nsWindowPtr = getNSWindowPtr();




 787         switch (windowState) {
 788             case Frame.ICONIFIED:
 789                 if (prevWindowState == Frame.MAXIMIZED_BOTH) {
 790                     // let's return into the normal states first
 791                     // the zoom call toggles between the normal and the max states
 792                     unmaximize();
 793                 }
 794                 CWrapper.NSWindow.miniaturize(nsWindowPtr);
 795                 break;
 796             case Frame.MAXIMIZED_BOTH:
 797                 if (prevWindowState == Frame.ICONIFIED) {
 798                     // let's return into the normal states first
 799                     CWrapper.NSWindow.deminiaturize(nsWindowPtr);
 800                 }
 801                 maximize();
 802                 break;
 803             case Frame.NORMAL:
 804                 if (prevWindowState == Frame.ICONIFIED) {
 805                     CWrapper.NSWindow.deminiaturize(nsWindowPtr);
 806                 } else if (prevWindowState == Frame.MAXIMIZED_BOTH) {


   1 /*
   2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 566                     CWrapper.NSWindow.makeKeyWindow(nsWindowPtr);
 567                 }
 568             } else {
 569                 CWrapper.NSWindow.orderOut(nsWindowPtr);
 570             }
 571         } else {
 572             // otherwise, put it in a proper z-order
 573             CWrapper.NSWindow.orderWindow(nsWindowPtr, CWrapper.NSWindow.NSWindowBelow,
 574                     ((CPlatformWindow)blocker.getPlatformWindow()).getNSWindowPtr());
 575         }
 576         this.visible = visible;
 577 
 578         // Manage the extended state when showing
 579         if (visible) {
 580             // Apply the extended state as expected in shared code
 581             if (target instanceof Frame) {
 582                 if (!wasMaximized && isMaximized()) {
 583                     // setVisible could have changed the native maximized state
 584                     deliverZoom(true);
 585                 } else {
 586                     int frameState = ((Frame)target).getExtendedState();
 587                     if ((frameState & Frame.ICONIFIED) != 0) {
 588                         // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
 589                         frameState = Frame.ICONIFIED;
 590                     }
 591                     switch (frameState) {
 592                         case Frame.ICONIFIED:
 593                             CWrapper.NSWindow.miniaturize(nsWindowPtr);
 594                             break;
 595                         case Frame.MAXIMIZED_BOTH:
 596                             maximize();
 597                             break;
 598                         default: // NORMAL
 599                             unmaximize(); // in case it was maximized, otherwise this is a no-op
 600                             break;
 601                     }
 602                 }
 603             }
 604         }
 605 
 606         nativeSynthesizeMouseEnteredExitedEvents();
 607 
 608         // Configure stuff #2
 609         updateFocusabilityForAutoRequestFocus(true);
 610 
 611         // Manage parent-child relationship when showing


 772         nativeExitFullScreenMode(getNSWindowPtr());
 773         isFullScreenMode = false;
 774     }
 775 
 776     @Override
 777     public boolean isFullScreenMode() {
 778         return isFullScreenMode;
 779     }
 780 
 781     @Override
 782     public void setWindowState(int windowState) {
 783         if (peer == null || !peer.isVisible()) {
 784             // setVisible() applies the state
 785             return;
 786         }
 787 
 788         int prevWindowState = peer.getState();
 789         if (prevWindowState == windowState) return;
 790 
 791         final long nsWindowPtr = getNSWindowPtr();
 792         if ((windowState & Frame.ICONIFIED) != 0) {
 793             // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
 794             windowState = Frame.ICONIFIED;
 795         }
 796         switch (windowState) {
 797             case Frame.ICONIFIED:
 798                 if (prevWindowState == Frame.MAXIMIZED_BOTH) {
 799                     // let's return into the normal states first
 800                     // the zoom call toggles between the normal and the max states
 801                     unmaximize();
 802                 }
 803                 CWrapper.NSWindow.miniaturize(nsWindowPtr);
 804                 break;
 805             case Frame.MAXIMIZED_BOTH:
 806                 if (prevWindowState == Frame.ICONIFIED) {
 807                     // let's return into the normal states first
 808                     CWrapper.NSWindow.deminiaturize(nsWindowPtr);
 809                 }
 810                 maximize();
 811                 break;
 812             case Frame.NORMAL:
 813                 if (prevWindowState == Frame.ICONIFIED) {
 814                     CWrapper.NSWindow.deminiaturize(nsWindowPtr);
 815                 } else if (prevWindowState == Frame.MAXIMIZED_BOTH) {