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 23 * questions. 24 */ 25 26 package sun.lwawt.macosx; 27 28 import com.apple.eawt.FullScreenAdapter; 29 import com.apple.eawt.FullScreenUtilities; 30 import com.apple.eawt.event.FullScreenEvent; 31 import java.awt.*; 32 import java.awt.Dialog.ModalityType; 33 import java.awt.event.*; 34 import java.beans.*; 35 import java.lang.reflect.InvocationTargetException; 36 import java.util.ArrayList; 37 import java.util.Arrays; 38 import java.util.concurrent.atomic.AtomicBoolean; 39 import java.util.concurrent.atomic.AtomicLong; 40 import java.util.concurrent.atomic.AtomicReference; 41 42 import javax.swing.*; 43 44 import sun.awt.*; 45 import sun.awt.AWTAccessor.ComponentAccessor; 46 import sun.awt.AWTAccessor.WindowAccessor; 47 import sun.java2d.SurfaceData; 48 import sun.java2d.opengl.CGLSurfaceData; 49 import sun.lwawt.*; 50 import sun.util.logging.PlatformLogger; 590 // If it ain't blocked, or is being hidden, go regular way 591 if (visible) { 592 contentView.execute(viewPtr -> { 593 execute(ptr -> CWrapper.NSWindow.makeFirstResponder(ptr, 594 viewPtr)); 595 }); 596 597 boolean isPopup = (target.getType() == Window.Type.POPUP); 598 execute(ptr -> { 599 if (isPopup) { 600 // Popups in applets don't activate applet's process 601 CWrapper.NSWindow.orderFrontRegardless(ptr); 602 } else { 603 CWrapper.NSWindow.orderFront(ptr); 604 } 605 606 boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(ptr); 607 if (!isKeyWindow) { 608 CWrapper.NSWindow.makeKeyWindow(ptr); 609 } 610 }); 611 } else { 612 execute(ptr->{ 613 // immediately hide the window 614 CWrapper.NSWindow.orderOut(ptr); 615 // process the close 616 CWrapper.NSWindow.close(ptr); 617 }); 618 } 619 } else { 620 // otherwise, put it in a proper z-order 621 CPlatformWindow bw 622 = (CPlatformWindow) blocker.getPlatformWindow(); 623 bw.execute(blockerPtr -> { 624 execute(ptr -> { 625 CWrapper.NSWindow.orderWindow(ptr, 626 CWrapper.NSWindow.NSWindowBelow, 627 blockerPtr); 628 }); 629 }); | 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 23 * questions. 24 */ 25 26 package sun.lwawt.macosx; 27 28 import java.awt.*; 29 import java.awt.Dialog.ModalityType; 30 import java.awt.event.*; 31 import java.beans.*; 32 import java.lang.reflect.InvocationTargetException; 33 import java.util.ArrayList; 34 import java.util.Arrays; 35 import java.util.concurrent.atomic.AtomicBoolean; 36 import java.util.concurrent.atomic.AtomicLong; 37 import java.util.concurrent.atomic.AtomicReference; 38 39 import javax.swing.*; 40 41 import sun.awt.*; 42 import sun.awt.AWTAccessor.ComponentAccessor; 43 import sun.awt.AWTAccessor.WindowAccessor; 44 import sun.java2d.SurfaceData; 45 import sun.java2d.opengl.CGLSurfaceData; 46 import sun.lwawt.*; 47 import sun.util.logging.PlatformLogger; 587 // If it ain't blocked, or is being hidden, go regular way 588 if (visible) { 589 contentView.execute(viewPtr -> { 590 execute(ptr -> CWrapper.NSWindow.makeFirstResponder(ptr, 591 viewPtr)); 592 }); 593 594 boolean isPopup = (target.getType() == Window.Type.POPUP); 595 execute(ptr -> { 596 if (isPopup) { 597 // Popups in applets don't activate applet's process 598 CWrapper.NSWindow.orderFrontRegardless(ptr); 599 } else { 600 CWrapper.NSWindow.orderFront(ptr); 601 } 602 603 boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(ptr); 604 if (!isKeyWindow) { 605 CWrapper.NSWindow.makeKeyWindow(ptr); 606 } 607 608 if (owner != null 609 && owner.getPeer() instanceof LWLightweightFramePeer) { 610 LWLightweightFramePeer peer = 611 (LWLightweightFramePeer) owner.getPeer(); 612 613 long ownerWindowPtr = peer.getOverriddenWindowHandle(); 614 if (ownerWindowPtr != 0) { 615 //Place window above JavaFX stage 616 CWrapper.NSWindow.addChildWindow( 617 ownerWindowPtr, ptr, 618 CWrapper.NSWindow.NSWindowAbove); 619 } 620 } 621 }); 622 } else { 623 execute(ptr->{ 624 // immediately hide the window 625 CWrapper.NSWindow.orderOut(ptr); 626 // process the close 627 CWrapper.NSWindow.close(ptr); 628 }); 629 } 630 } else { 631 // otherwise, put it in a proper z-order 632 CPlatformWindow bw 633 = (CPlatformWindow) blocker.getPlatformWindow(); 634 bw.execute(blockerPtr -> { 635 execute(ptr -> { 636 CWrapper.NSWindow.orderWindow(ptr, 637 CWrapper.NSWindow.NSWindowBelow, 638 blockerPtr); 639 }); 640 }); |