Skip to content

Commit

Permalink
Use NSWindow API for changing fullscreen mode
Browse files Browse the repository at this point in the history
instead of going through NSView's API. The latter does offer more options, but messes up the fullscreen mode for some reason (UI becomes unresponsives because input events are no longer received).

Using `self.window toggleFullScreen:self` also does not mess with additional displays (only the display showing Squeak is put into fullscreen mode).
  • Loading branch information
fniephaus committed Feb 28, 2020
1 parent 11a8128 commit edd5152
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m
Expand Up @@ -48,6 +48,7 @@

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

static sqSqueakOSXMetalView *mainMetalView;

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

if (!firstDrawCompleted) {
firstDrawCompleted = YES;
extern sqInt getFullScreenFlag(void);
if (getFullScreenFlag() == 0) {
[self.window makeKeyAndOrderFront: self];
}
Expand Down Expand Up @@ -876,25 +876,13 @@ - (BOOL)ignoreModifierKeysWhileDragging {
#pragma mark Fullscreen

- (void) ioSetFullScreen: (sqInt) fullScreen {
if (getFullScreenFlag() == (fullScreen == 1))
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 == 0)) {
if ([self.window isKeyWindow] == NO) {
[self.window makeKeyAndOrderFront: self];
}
Expand Down

0 comments on commit edd5152

Please sign in to comment.