Skip to content

Commit 05d149f

Browse files
committed
Use NSWindow API for changing fullscreen mode
instead of going through NSView's API. The latter does offer more options, but messes up the fullscreen mode for some reason (UI becomes unresponsive 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).
1 parent 11a8128 commit 05d149f

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
extern SqueakOSXAppDelegate *gDelegateApp;
5050
extern struct VirtualMachine* interpreterProxy;
51+
extern int getFullScreenFlag();
5152

5253
static sqSqueakOSXMetalView *mainMetalView;
5354

@@ -230,7 +231,6 @@ - (void) drawThelayers {
230231

231232
if (!firstDrawCompleted) {
232233
firstDrawCompleted = YES;
233-
extern sqInt getFullScreenFlag(void);
234234
if (getFullScreenFlag() == 0) {
235235
[self.window makeKeyAndOrderFront: self];
236236
}
@@ -876,25 +876,13 @@ - (BOOL)ignoreModifierKeysWhileDragging {
876876
#pragma mark Fullscreen
877877

878878
- (void) ioSetFullScreen: (sqInt) fullScreen {
879+
if (getFullScreenFlag() == (fullScreen == 1))
880+
return; // not changing fullscreen mode
879881

880-
if ([self isInFullScreenMode] == YES && (fullScreen == 1))
881-
return;
882-
if ([self isInFullScreenMode] == NO && (fullScreen == 0))
883-
return;
884-
885-
if ([self isInFullScreenMode] == NO && (fullScreen == 1)) {
886-
self.fullScreenInProgress = YES;
887-
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
888-
[NSNumber numberWithInt:
889-
NSApplicationPresentationHideDock |
890-
NSApplicationPresentationHideMenuBar ],
891-
NSFullScreenModeApplicationPresentationOptions, nil];
892-
[self enterFullScreenMode:[NSScreen mainScreen] withOptions:options];
893-
}
882+
self.fullScreenInProgress = YES;
883+
[self.window toggleFullScreen:self];
894884

895-
if ([self isInFullScreenMode] == YES && (fullScreen == 0)) {
896-
self.fullScreenInProgress = YES;
897-
[self exitFullScreenModeWithOptions: NULL];
885+
if (getFullScreenFlag() && (fullScreen == 0)) {
898886
if ([self.window isKeyWindow] == NO) {
899887
[self.window makeKeyAndOrderFront: self];
900888
}

0 commit comments

Comments
 (0)