[Vm-dev] [commit][3686] (Tobias, Bert) Change fullscreen behavior of Cocoa VMs.

commits at squeakvm.org commits at squeakvm.org
Wed Apr 27 15:01:34 UTC 2016


Revision: 3686
Author:   topa
Date:     2016-04-27 08:01:30 -0700 (Wed, 27 Apr 2016)
Log Message:
-----------
(Tobias, Bert) Change fullscreen behavior of Cocoa VMs.

 - remove slow fadein/fadeout
 - provide correct fullscreen options
 - enable 'Fullscreen' button in window title bar

Modified Paths:
--------------
    branches/Cog/platforms/iOS/vm/English.lproj/MainMenu.xib
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m

Modified: branches/Cog/platforms/iOS/vm/English.lproj/MainMenu.xib
===================================================================
--- branches/Cog/platforms/iOS/vm/English.lproj/MainMenu.xib	2016-04-23 18:06:55 UTC (rev 3685)
+++ branches/Cog/platforms/iOS/vm/English.lproj/MainMenu.xib	2016-04-27 15:01:30 UTC (rev 3686)
@@ -508,7 +508,8 @@
 				</object>
 				<string key="NSScreenRect">{{0, 0}, {2560, 1417}}</string>
 				<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
-				<bool key="NSWindowIsRestorable">YES</bool>
+				<int key="NSWindowCollectionBehavior">128</int>
+				<bool key="NSWindowIsRestorable">NO</bool>
 			</object>
 			<object class="NSCustomObject" id="976324537">
 				<string key="NSClassName">SqueakOSXAppDelegate</string>

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m	2016-04-23 18:06:55 UTC (rev 3685)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m	2016-04-27 15:01:30 UTC (rev 3686)
@@ -624,7 +624,7 @@
 	return YES;
 }
 
-- (void)  ioSetFullScreen: (sqInt) fullScreen {	
+- (void)  ioSetFullScreen: (sqInt) fullScreen {
 	
 	if ([self isInFullScreenMode] == YES && (fullScreen == 1)) 
 		return;
@@ -633,17 +633,18 @@
 	
 	if ([self isInFullScreenMode] == NO && (fullScreen == 1)) {
 		self.savedScreenBoundsAtTimeOfFullScreen = (NSRect) [self bounds];
-		[self fadeOut];
-		[self enterFullScreenMode:[NSScreen mainScreen] withOptions: nil];
+		NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
+			[NSNumber numberWithInt:
+				NSApplicationPresentationHideDock |
+				NSApplicationPresentationHideMenuBar ],
+			NSFullScreenModeApplicationPresentationOptions, nil];
+		[self enterFullScreenMode:[NSScreen mainScreen] withOptions:options];
 		extern struct	VirtualMachine* interpreterProxy;
 		interpreterProxy->fullDisplayUpdate();
-		[self fadeIn];
 	}
 	
 	if ([self isInFullScreenMode] == YES && (fullScreen == 0)) {
-		[self fadeOut];
 		[self exitFullScreenModeWithOptions: NULL];
-		[self fadeIn];
 		if ([self.window isKeyWindow] == NO) {
 			[self.window makeKeyAndOrderFront: self];
 			//	NOT SURE IF THIS IS NEEDED, MORE TESTING	[self.window setContentSize: self.savedScreenBoundsAtTimeOfFullScreen.size];
@@ -651,37 +652,4 @@
 	}
 }
 
-- (void)fadeOut {
-	CGDisplayErr    err;
-	
-	err = CGAcquireDisplayFadeReservation((CGDisplayReservationInterval)kCGMaxDisplayReservationInterval,
-										  &fadeToken);
-	if (err == kCGErrorSuccess) {
-		CGDisplayFade(fadeToken,
-					  ((sqSqueakOSXInfoPlistInterface*) gDelegateApp.squeakApplication.infoPlistInterfaceLogic).SqueakUIFadeForFullScreenInSeconds,
-					  (CGDisplayBlendFraction)kCGDisplayBlendNormal,
-					  (CGDisplayBlendFraction)kCGDisplayBlendSolidColor,
-					  0.0f,
-					  0.0f,
-					  0.0f,
-					  TRUE);
-	} 
-} 
-
-- (void)fadeIn {
-	CGDisplayErr    err;
-	
-	err = CGDisplayFade(fadeToken,
-						((sqSqueakOSXInfoPlistInterface*) gDelegateApp.squeakApplication.infoPlistInterfaceLogic).SqueakUIFadeForFullScreenInSeconds,
-						(CGDisplayBlendFraction)kCGDisplayBlendSolidColor,
-						(CGDisplayBlendFraction)kCGDisplayBlendNormal,
-						0.0f,
-						0.0f,
-						0.0f,
-						TRUE);
-	if (err == kCGErrorSuccess) {
-		CGReleaseDisplayFadeReservation(fadeToken);
-	} 
-}
-
 @end

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	2016-04-23 18:06:55 UTC (rev 3685)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	2016-04-27 15:01:30 UTC (rev 3686)
@@ -713,7 +713,7 @@
 	return YES;
 }
 
-- (void)  ioSetFullScreen: (sqInt) fullScreen {	
+- (void)  ioSetFullScreen: (sqInt) fullScreen {
 	
 	if ([self isInFullScreenMode] == YES && (fullScreen == 1)) 
 		return;
@@ -722,17 +722,18 @@
 	
 	if ([self isInFullScreenMode] == NO && (fullScreen == 1)) {
 		self.savedScreenBoundsAtTimeOfFullScreen = (NSRect) [self bounds];
-		[self fadeOut];
-		[self enterFullScreenMode:[NSScreen mainScreen] withOptions: nil];
+		NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
+			[NSNumber numberWithInt:
+				NSApplicationPresentationHideDock |
+				NSApplicationPresentationHideMenuBar ],
+			NSFullScreenModeApplicationPresentationOptions, nil];
+		[self enterFullScreenMode:[NSScreen mainScreen] withOptions:options];
 		extern struct	VirtualMachine* interpreterProxy;
 		interpreterProxy->fullDisplayUpdate();
-		[self fadeIn];
 	}
 	
 	if ([self isInFullScreenMode] == YES && (fullScreen == 0)) {
-		[self fadeOut];
 		[self exitFullScreenModeWithOptions: NULL];
-		[self fadeIn];
 		if ([self.window isKeyWindow] == NO) {
 			[self.window makeKeyAndOrderFront: self];
 			//	NOT SURE IF THIS IS NEEDED, MORE TESTING	[self.window setContentSize: self.savedScreenBoundsAtTimeOfFullScreen.size];
@@ -740,39 +741,6 @@
 	}
 }
 
-- (void)fadeOut {
-	CGDisplayErr    err;
-	
-	err = CGAcquireDisplayFadeReservation((CGDisplayReservationInterval)kCGMaxDisplayReservationInterval,
-										  &fadeToken);
-	if (err == kCGErrorSuccess) {
-		CGDisplayFade(fadeToken,
-					  ((sqSqueakOSXInfoPlistInterface*) gDelegateApp.squeakApplication.infoPlistInterfaceLogic).SqueakUIFadeForFullScreenInSeconds,
-					  (CGDisplayBlendFraction)kCGDisplayBlendNormal,
-					  (CGDisplayBlendFraction)kCGDisplayBlendSolidColor,
-					  0.0f,
-					  0.0f,
-					  0.0f,
-					  TRUE);
-	} 
-} 
-
-- (void)fadeIn {
-	CGDisplayErr    err;
-	
-	err = CGDisplayFade(fadeToken,
-						((sqSqueakOSXInfoPlistInterface*) gDelegateApp.squeakApplication.infoPlistInterfaceLogic).SqueakUIFadeForFullScreenInSeconds,
-						(CGDisplayBlendFraction)kCGDisplayBlendSolidColor,
-						(CGDisplayBlendFraction)kCGDisplayBlendNormal,
-						0.0f,
-						0.0f,
-						0.0f,
-						TRUE);
-	if (err == kCGErrorSuccess) {
-		CGReleaseDisplayFadeReservation(fadeToken);
-	} 
-}
-
 - (void) preDrawThelayers {
 }
 



More information about the Vm-dev mailing list