diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m b/platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m index 2bf3661944..a6252e6c18 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m @@ -48,6 +48,7 @@ extern SqueakOSXAppDelegate *gDelegateApp; extern struct VirtualMachine* interpreterProxy; +extern sqInt getFullScreenFlag(); static sqSqueakOSXMetalView *mainMetalView; @@ -230,8 +231,7 @@ - (void) drawThelayers { if (!firstDrawCompleted) { firstDrawCompleted = YES; - extern sqInt getFullScreenFlag(void); - if (getFullScreenFlag() == 0) { + if (!getFullScreenFlag()) { [self.window makeKeyAndOrderFront: self]; } } @@ -876,25 +876,13 @@ - (BOOL)ignoreModifierKeysWhileDragging { #pragma mark Fullscreen - (void) ioSetFullScreen: (sqInt) fullScreen { + if (getFullScreenFlag() == fullScreen) + return; // not changing fullscreen mode - if ([self isInFullScreenMode] == YES && (fullScreen == 1)) - return; - if ([self isInFullScreenMode] == NO && (fullScreen == 0)) - return; - - if ([self isInFullScreenMode] == NO && (fullScreen == 1)) { - self.fullScreenInProgress = YES; - NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt: - NSApplicationPresentationHideDock | - NSApplicationPresentationHideMenuBar ], - NSFullScreenModeApplicationPresentationOptions, nil]; - [self enterFullScreenMode:[NSScreen mainScreen] withOptions:options]; - } + self.fullScreenInProgress = YES; + [self.window toggleFullScreen:self]; - if ([self isInFullScreenMode] == YES && (fullScreen == 0)) { - self.fullScreenInProgress = YES; - [self exitFullScreenModeWithOptions: NULL]; + if (getFullScreenFlag() && !fullScreen) { if ([self.window isKeyWindow] == NO) { [self.window makeKeyAndOrderFront: self]; }