@@ -23,6 +23,18 @@ class VMDisplayAppleDisplayWindowController: VMDisplayAppleWindowController {
23
23
mainView as? VZVirtualMachineView
24
24
}
25
25
26
+ var supportsReconfiguration : Bool {
27
+ guard #available( macOS 14 , * ) else {
28
+ return false
29
+ }
30
+ guard let display = appleVM. apple? . graphicsDevices. first? . displays. first else {
31
+ return false
32
+ }
33
+ return display. value ( forKey: " _supportsReconfiguration " ) as? Bool ?? false
34
+ }
35
+
36
+ private var aspectRatioLocked : Bool = false
37
+
26
38
override func windowDidLoad( ) {
27
39
mainView = VZVirtualMachineView ( )
28
40
captureMouseToolbarButton. image = captureMouseToolbarButton. alternateImage // show capture keyboard image
@@ -31,6 +43,9 @@ class VMDisplayAppleDisplayWindowController: VMDisplayAppleWindowController {
31
43
32
44
override func enterLive( ) {
33
45
appleView. virtualMachine = appleVM. apple
46
+ if #available( macOS 14 , * ) {
47
+ appleView. automaticallyReconfiguresDisplay = true
48
+ }
34
49
super. enterLive ( )
35
50
}
36
51
@@ -59,6 +74,7 @@ class VMDisplayAppleDisplayWindowController: VMDisplayAppleWindowController {
59
74
let size = windowSize ( for: primaryDisplay)
60
75
let frame = window. frameRect ( forContentRect: CGRect ( origin: window. frame. origin, size: size) )
61
76
window. contentAspectRatio = size
77
+ aspectRatioLocked = true
62
78
window. minSize = NSSize ( width: 400 , height: 400 )
63
79
window. setFrame ( frame, display: false , animate: true )
64
80
super. updateWindowFrame ( )
@@ -81,4 +97,11 @@ class VMDisplayAppleDisplayWindowController: VMDisplayAppleWindowController {
81
97
captureMouseToolbarButton. state = . off
82
98
captureMouseButtonPressed ( self )
83
99
}
100
+
101
+ func windowDidResize( _ notification: Notification ) {
102
+ if aspectRatioLocked && supportsReconfiguration {
103
+ window!. resizeIncrements = NSSize ( width: 1.0 , height: 1.0 )
104
+ aspectRatioLocked = false
105
+ }
106
+ }
84
107
}
0 commit comments