diff options
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 61b853d79b0..2be89af8ebe 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -851,6 +851,16 @@ GHOST_TWindowState GHOST_WindowCocoa::getState() const GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getState(): window invalid"); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; GHOST_TWindowState state; + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + NSUInteger masks = [m_window styleMask]; + + if (masks & NSFullScreenWindowMask) { + // Lion style fullscreen + state = GHOST_kWindowStateFullScreen; + } + else +#endif if (m_fullScreen) { state = GHOST_kWindowStateFullScreen; } @@ -959,8 +969,14 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state) [m_window zoom:nil]; break; - case GHOST_kWindowStateFullScreen: + case GHOST_kWindowStateFullScreen: { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + NSUInteger masks = [m_window styleMask]; + + if (!m_fullScreen && !(masks & NSFullScreenWindowMask)) { +#else if (!m_fullScreen) { +#endif NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; /* This status change needs to be done before Cocoa call to enter fullscreen mode @@ -969,6 +985,11 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state) m_fullScreen = true; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + /* Disable toggle for Lion style fullscreen */ + [m_window setCollectionBehavior:NSWindowCollectionBehaviorDefault]; +#endif + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 //10.6 provides Cocoa functions to autoshow menu bar, and to change a window style //Hide menu & dock if on primary screen. else only menu if ([[m_window screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) { @@ -1017,12 +1038,27 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state) [pool drain]; } break; + } case GHOST_kWindowStateNormal: default: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + NSUInteger masks = [m_window styleMask]; + + if (masks & NSFullScreenWindowMask) { + // Lion style fullscreen + [m_window toggleFullScreen:nil]; + } + else +#endif if (m_fullScreen) { m_fullScreen = false; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 + /* Enable toggle for into Lion style fullscreen */ + [m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; +#endif + //Exit fullscreen #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 //Show again menu & dock if needed |