Skip to content

Commit 6853b2c

Browse files
committed
display(apple): fix screenshot for apple display
1 parent e443413 commit 6853b2c

3 files changed

+16
-4
lines changed

Platform/macOS/Display/VMDisplayAppleDisplayWindowController.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ class VMDisplayAppleDisplayWindowController: VMDisplayAppleWindowController {
2222
var appleView: VZVirtualMachineView! {
2323
mainView as? VZVirtualMachineView
2424
}
25-
25+
26+
override var contentView: NSView? {
27+
appleView
28+
}
29+
2630
var supportsReconfiguration: Bool {
2731
guard #available(macOS 14, *) else {
2832
return false

Platform/macOS/Display/VMDisplayAppleTerminalWindowController.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ class VMDisplayAppleTerminalWindowController: VMDisplayAppleWindowController, VM
2121
var terminalView: TerminalView! {
2222
mainView as? TerminalView
2323
}
24-
24+
25+
override var contentView: NSView? {
26+
terminalView
27+
}
28+
2529
var serialConfig: UTMAppleConfigurationSerial! {
2630
appleConfig.serials[index]
2731
}

Platform/macOS/Display/VMDisplayAppleWindowController.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import Foundation
1818

1919
class VMDisplayAppleWindowController: VMDisplayWindowController {
2020
var mainView: NSView?
21-
21+
22+
var contentView: NSView? {
23+
nil
24+
}
25+
2226
var isInstallSuccessful: Bool = false
2327

2428
var appleVM: UTMAppleVirtualMachine! {
@@ -402,7 +406,7 @@ extension VMDisplayAppleWindowController {
402406

403407
extension VMDisplayAppleWindowController: UTMScreenshotProvider {
404408
var screenshot: UTMVirtualMachineScreenshot? {
405-
if let image = mainView?.image() {
409+
if let image = contentView?.image() {
406410
return UTMVirtualMachineScreenshot(wrapping: image)
407411
} else {
408412
return nil

0 commit comments

Comments
 (0)