Merge pull request #2361 from akihikodaki/master

Fix resolution scaling from Cocoa to guest
This commit is contained in:
osy 2021-03-04 22:46:06 -08:00 committed by GitHub
commit aaee0ffc16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

2
.gitignore vendored
View File

@ -67,6 +67,6 @@ fastlane/test_output
iOSInjectionProject/
build/
build*/
sysroot*/
.DS_Store

View File

@ -187,7 +187,7 @@ extension VMDisplayMetalWindowController {
fileprivate func updateGuestResolution(for window: NSWindow, frameSize: NSSize) -> NSSize {
guard let vmDisplay = self.vmDisplay else { return frameSize }
let currentScreenScale = window.screen?.backingScaleFactor ?? 1.0
let nativeScale = isAlwaysNativeResolution ? 1.0 : currentScreenScale
let nativeScale = isAlwaysNativeResolution ? currentScreenScale : 1.0
let targetSize = window.contentRect(forFrameRect: CGRect(origin: .zero, size: frameSize)).size
let targetSizeScaled = isAlwaysNativeResolution ? targetSize.applying(CGAffineTransform(scaleX: nativeScale, y: nativeScale)) : targetSize
logger.debug("Requesting resolution: (\(targetSizeScaled.width), \(targetSizeScaled.height))")