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

Print this page

        

*** 190,205 **** if (root == null || (LWWindowPeer)root.getPeer() == null) return null; return (CPlatformWindow)((LWWindowPeer)root.getPeer()).getPlatformWindow(); } }; // Bounds of the native widget but in the Java coordinate system. // In order to keep it up-to-date we will update them on // 1) setting native bounds via nativeSetBounds() call // 2) getting notification from the native level via deliverMoveResizeEvent() private Rectangle nativeBounds; ! private volatile boolean isFullScreenMode = false; private Window target; private LWWindowPeer peer; private CPlatformView contentView; private CPlatformWindow owner; --- 190,208 ---- if (root == null || (LWWindowPeer)root.getPeer() == null) return null; return (CPlatformWindow)((LWWindowPeer)root.getPeer()).getPlatformWindow(); } }; + private final Object LOCK = new Object(){}; + // Bounds of the native widget but in the Java coordinate system. // In order to keep it up-to-date we will update them on // 1) setting native bounds via nativeSetBounds() call // 2) getting notification from the native level via deliverMoveResizeEvent() private Rectangle nativeBounds; ! ! private boolean isFullScreenMode = false; // synchronized on the LOCK private Window target; private LWWindowPeer peer; private CPlatformView contentView; private CPlatformWindow owner;
*** 652,672 **** long clearColor = CWrapper.NSColor.clearColor(); CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor); } } @Override public void enterFullScreenMode() { isFullScreenMode = true; ! contentView.enterFullScreenMode(getNSWindowPtr()); } @Override public void exitFullScreenMode() { ! contentView.exitFullScreenMode(); isFullScreenMode = false; } @Override public void setWindowState(int windowState) { if (!peer.isVisible()) { // setVisible() applies the state --- 655,701 ---- long clearColor = CWrapper.NSColor.clearColor(); CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor); } } + private void setMenuBarVisibleIfOnPrimaryScreen(boolean visible) { + long screen = CWrapper.NSWindow.screen(getNSWindowPtr()); + try { + long primaryScreen = CWrapper.NSScreen.screens_0(); + try { + if (primaryScreen == screen) { + CWrapper.NSMenu.setMenuBarVisible(visible); + } + } finally { + CWrapper.NSObject.release(primaryScreen); + } + } finally { + CWrapper.NSObject.release(screen); + } + } + @Override public void enterFullScreenMode() { + synchronized (LOCK) { + if (!isFullScreenMode) { isFullScreenMode = true; ! setMenuBarVisibleIfOnPrimaryScreen(false); ! CWrapper.NSWindow.toggleFullScreen(getNSWindowPtr(), 0L); ! } ! } } @Override public void exitFullScreenMode() { ! synchronized (LOCK) { ! if (isFullScreenMode) { ! CWrapper.NSWindow.toggleFullScreen(getNSWindowPtr(), 0L); ! setMenuBarVisibleIfOnPrimaryScreen(true); isFullScreenMode = false; } + } + } @Override public void setWindowState(int windowState) { if (!peer.isVisible()) { // setVisible() applies the state
*** 761,776 **** private void deliverWindowFocusEvent(boolean gained){ peer.notifyActivation(gained); } private void deliverMoveResizeEvent(int x, int y, int width, int height) { - // when the content view enters the full-screen mode, the native - // move/resize notifications contain a bounds smaller than - // the whole screen and therefore we ignore the native notifications - // and the content view itself creates correct synthetic notifications - if (isFullScreenMode) return; - nativeBounds = new Rectangle(x, y, width, height); peer.notifyReshape(x, y, width, height); //TODO validateSurface already called from notifyReshape validateSurface(); } --- 790,799 ----