Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-06 17:39:25 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-06 17:39:25 +0400
commit2a4ee23a2559a3b6b7d443ae706a567092d5da7d (patch)
tree00317c18299ffde4d782043ec2e8de9eeea36860
parentad7a74f58dfbcaf370630e88efa86e3f9217cfce (diff)
Fix #35225: new OS X Lion fullscreen did not work together well with old
fullscreen option. It was possible to enable both at the same time which got you stuck in a state where it was impossible to exit fullscreen. Now I've made them mutually exlusive, only one can be enabled at the same time. Note the reason we need to support both is because the new Lion fullscreen does not work with multiple monitors, it will just give black screens on the other monitors. This is a limitation of OS X, you can find many complaints about this online.
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm38
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