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
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) {
807 // the zoom call toggles between the normal and the max states
|
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
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 | Frame.MAXIMIZED_BOTH:
789 // Protects against RuntimeException thrown from "default" case, despite of the fact
790 // that "java.awt.Frame.isFrameStateSupported" returns true for this bitwise mask.
791 case Frame.ICONIFIED:
792 if (prevWindowState == Frame.MAXIMIZED_BOTH) {
793 // let's return into the normal states first
794 // the zoom call toggles between the normal and the max states
795 unmaximize();
796 }
797 CWrapper.NSWindow.miniaturize(nsWindowPtr);
798 break;
799 case Frame.MAXIMIZED_BOTH:
800 if (prevWindowState == Frame.ICONIFIED) {
801 // let's return into the normal states first
802 CWrapper.NSWindow.deminiaturize(nsWindowPtr);
803 }
804 maximize();
805 break;
806 case Frame.NORMAL:
807 if (prevWindowState == Frame.ICONIFIED) {
808 CWrapper.NSWindow.deminiaturize(nsWindowPtr);
809 } else if (prevWindowState == Frame.MAXIMIZED_BOTH) {
810 // the zoom call toggles between the normal and the max states
|