Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NSWindow API for changing fullscreen mode #478

Merged
merged 2 commits into from Feb 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 7 additions & 19 deletions platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m
Expand Up @@ -48,6 +48,7 @@

extern SqueakOSXAppDelegate *gDelegateApp;
extern struct VirtualMachine* interpreterProxy;
extern sqInt getFullScreenFlag();

static sqSqueakOSXMetalView *mainMetalView;

Expand Down Expand Up @@ -230,8 +231,7 @@ - (void) drawThelayers {

if (!firstDrawCompleted) {
firstDrawCompleted = YES;
extern sqInt getFullScreenFlag(void);
if (getFullScreenFlag() == 0) {
if (!getFullScreenFlag()) {
[self.window makeKeyAndOrderFront: self];
}
}
Expand Down Expand Up @@ -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];
}
Expand Down