< prev index next >

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

Print this page




 782         Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
 783         final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
 784         if( w != null && acc.getPeer(w) != null
 785                 && ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
 786                 && !lwcToolkit.isApplicationActive()) {
 787             lwcToolkit.activateApplicationIgnoringOtherApps();
 788         }
 789         updateFocusabilityForAutoRequestFocus(false);
 790         execute(CPlatformWindow::nativePushNSWindowToFront);
 791         updateFocusabilityForAutoRequestFocus(true);
 792     }
 793 
 794     private void setCanFullscreen(final boolean canFullScreen) {
 795         if (target instanceof RootPaneContainer
 796                 && getPeer().getPeerType() == PeerType.FRAME) {
 797 
 798             if (isInFullScreen && !canFullScreen) {
 799                 toggleFullScreen();
 800             }
 801 


 802             final RootPaneContainer rpc = (RootPaneContainer) target;
 803             rpc.getRootPane().putClientProperty(
 804                     CPlatformWindow.WINDOW_FULLSCREENABLE, canFullScreen);
 805         }
 806     }

 807 
 808     @Override
 809     public void setResizable(final boolean resizable) {
 810         setCanFullscreen(resizable);
 811         setStyleBits(RESIZABLE, resizable);
 812         setStyleBits(ZOOMABLE, resizable);
 813     }
 814 
 815     @Override
 816     public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
 817         execute(ptr -> nativeSetNSWindowMinMax(ptr, minW, minH, maxW, maxH));
 818     }
 819 
 820     @Override
 821     public boolean rejectFocusRequest(FocusEvent.Cause cause) {
 822         // Cross-app activation requests are not allowed.
 823         if (cause != FocusEvent.Cause.MOUSE_EVENT &&
 824             !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive())
 825         {
 826             focusLogger.fine("the app is inactive, so the request is rejected");




 782         Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
 783         final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
 784         if( w != null && acc.getPeer(w) != null
 785                 && ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
 786                 && !lwcToolkit.isApplicationActive()) {
 787             lwcToolkit.activateApplicationIgnoringOtherApps();
 788         }
 789         updateFocusabilityForAutoRequestFocus(false);
 790         execute(CPlatformWindow::nativePushNSWindowToFront);
 791         updateFocusabilityForAutoRequestFocus(true);
 792     }
 793 
 794     private void setCanFullscreen(final boolean canFullScreen) {
 795         if (target instanceof RootPaneContainer
 796                 && getPeer().getPeerType() == PeerType.FRAME) {
 797 
 798             if (isInFullScreen && !canFullScreen) {
 799                 toggleFullScreen();
 800             }
 801 
 802             Frame[] frame = Frame.getFrames();
 803             if ((Frame)target == frame[0]) {
 804                 final RootPaneContainer rpc = (RootPaneContainer) target;
 805                 rpc.getRootPane().putClientProperty(
 806                     CPlatformWindow.WINDOW_FULLSCREENABLE, canFullScreen);
 807             }
 808         }
 809     }
 810 
 811     @Override
 812     public void setResizable(final boolean resizable) {
 813         setCanFullscreen(resizable);
 814         setStyleBits(RESIZABLE, resizable);
 815         setStyleBits(ZOOMABLE, resizable);
 816     }
 817 
 818     @Override
 819     public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
 820         execute(ptr -> nativeSetNSWindowMinMax(ptr, minW, minH, maxW, maxH));
 821     }
 822 
 823     @Override
 824     public boolean rejectFocusRequest(FocusEvent.Cause cause) {
 825         // Cross-app activation requests are not allowed.
 826         if (cause != FocusEvent.Cause.MOUSE_EVENT &&
 827             !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive())
 828         {
 829             focusLogger.fine("the app is inactive, so the request is rejected");


< prev index next >