[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56512] trunk/blender/intern/ghost/intern/ GHOST_WindowCocoa.mm: Fix #35225: new OS X Lion fullscreen did not work together well with old

Brecht Van Lommel brechtvanlommel at pandora.be
Mon May 6 15:39:25 CEST 2013


Revision: 56512
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56512
Author:   blendix
Date:     2013-05-06 13:39:25 +0000 (Mon, 06 May 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2013-05-06 12:27:14 UTC (rev 56511)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2013-05-06 13:39:25 UTC (rev 56512)
@@ -851,6 +851,16 @@
 	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 @@
 			[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 @@
 				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 @@
 				[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




More information about the Bf-blender-cvs mailing list