mirror of https://github.com/xemu-project/xemu.git
ui/cocoa: Remove the uses of full screen APIs
The detections of [NSView -enterFullScreen:] and [NSView -exitFullScreen:] were wrong. A detection is coded as: [NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)] but it should be: [NSView instancesRespondToSelector:@selector(exitFullScreenModeWithOptions:)] Because of those APIs were not detected, ui/cocoa always falled back to a borderless window whose frame matches the screen to implement fullscreen behavior. The code using [NSView -enterFullScreen:] and [NSView -exitFullScreen:] will be used if you fix the detections, but its behavior is undesirable; the full screen view stretches the video, changing the aspect ratio, even if zooming is disabled. This change removes the code as it does nothing good. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210220013138.51437-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
cbcf09872a
commit
1e8b6f2b49
41
ui/cocoa.m
41
ui/cocoa.m
|
@ -585,37 +585,26 @@ QemuCocoaView *cocoaView;
|
||||||
isFullscreen = FALSE;
|
isFullscreen = FALSE;
|
||||||
[self ungrabMouse];
|
[self ungrabMouse];
|
||||||
[self setContentDimensions];
|
[self setContentDimensions];
|
||||||
if ([NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime
|
[fullScreenWindow close];
|
||||||
[self exitFullScreenModeWithOptions:nil];
|
[normalWindow setContentView: self];
|
||||||
} else {
|
[normalWindow makeKeyAndOrderFront: self];
|
||||||
[fullScreenWindow close];
|
[NSMenu setMenuBarVisible:YES];
|
||||||
[normalWindow setContentView: self];
|
|
||||||
[normalWindow makeKeyAndOrderFront: self];
|
|
||||||
[NSMenu setMenuBarVisible:YES];
|
|
||||||
}
|
|
||||||
} else { // switch from desktop to fullscreen
|
} else { // switch from desktop to fullscreen
|
||||||
isFullscreen = TRUE;
|
isFullscreen = TRUE;
|
||||||
[normalWindow orderOut: nil]; /* Hide the window */
|
[normalWindow orderOut: nil]; /* Hide the window */
|
||||||
[self grabMouse];
|
[self grabMouse];
|
||||||
[self setContentDimensions];
|
[self setContentDimensions];
|
||||||
if ([NSView respondsToSelector:@selector(enterFullScreenMode:withOptions:)]) { // test if "enterFullScreenMode:withOptions" is supported on host at runtime
|
[NSMenu setMenuBarVisible:NO];
|
||||||
[self enterFullScreenMode:[NSScreen mainScreen] withOptions:[NSDictionary dictionaryWithObjectsAndKeys:
|
fullScreenWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame]
|
||||||
[NSNumber numberWithBool:NO], NSFullScreenModeAllScreens,
|
styleMask:NSWindowStyleMaskBorderless
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], kCGDisplayModeIsStretched, nil], NSFullScreenModeSetting,
|
backing:NSBackingStoreBuffered
|
||||||
nil]];
|
defer:NO];
|
||||||
} else {
|
[fullScreenWindow setAcceptsMouseMovedEvents: YES];
|
||||||
[NSMenu setMenuBarVisible:NO];
|
[fullScreenWindow setHasShadow:NO];
|
||||||
fullScreenWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame]
|
[fullScreenWindow setBackgroundColor: [NSColor blackColor]];
|
||||||
styleMask:NSWindowStyleMaskBorderless
|
[self setFrame:NSMakeRect(cx, cy, cw, ch)];
|
||||||
backing:NSBackingStoreBuffered
|
[[fullScreenWindow contentView] addSubview: self];
|
||||||
defer:NO];
|
[fullScreenWindow makeKeyAndOrderFront:self];
|
||||||
[fullScreenWindow setAcceptsMouseMovedEvents: YES];
|
|
||||||
[fullScreenWindow setHasShadow:NO];
|
|
||||||
[fullScreenWindow setBackgroundColor: [NSColor blackColor]];
|
|
||||||
[self setFrame:NSMakeRect(cx, cy, cw, ch)];
|
|
||||||
[[fullScreenWindow contentView] addSubview: self];
|
|
||||||
[fullScreenWindow makeKeyAndOrderFront:self];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue