feat: default compact mode to the top-right corner

This commit is contained in:
2026-10-10 22:07:07 +02:00
parent a6bebb05c0
commit 25d674d84d
3 changed files with 10 additions and 10 deletions
+8 -8
View File
@@ -69,10 +69,10 @@ struct CompactWindowChecks {
let usableScreen = NSRect(x: -1_200, y: 50, width: 1_200, height: 800)
let landscape = CompactWindowController.initialFrame(aspect: 16.0 / 9.0, visibleFrame: usableScreen)
try require(sameFrame(landscape, NSRect(x: -336, y: 66, width: 320, height: 180)),
"16:9 enters at bottom right with 320pt width and 16pt inset")
try require(sameFrame(landscape, NSRect(x: -336, y: 654, width: 320, height: 180)),
"16:9 enters at top right with 320pt width and 16pt inset")
let portrait = CompactWindowController.initialFrame(aspect: 9.0 / 16.0, visibleFrame: usableScreen)
try require(sameFrame(portrait, NSRect(x: -336, y: 66, width: 320, height: 5_120.0 / 9.0)),
try require(sameFrame(portrait, NSRect(x: -336, y: 834 - 5_120.0 / 9.0, width: 320, height: 5_120.0 / 9.0)),
"portrait preserves exact aspect when it fits")
for aspect in [16.0 / 9.0, 9.0 / 16.0, 100.0, 0.01] {
let frame = CompactWindowController.initialFrame(aspect: aspect, visibleFrame: usableScreen)
@@ -84,12 +84,12 @@ struct CompactWindowChecks {
try require(frame.minX >= usableScreen.minX + 16 && frame.minY >= usableScreen.minY + 16
&& frame.maxX <= usableScreen.maxX - 16 && frame.maxY <= usableScreen.maxY - 16,
"aspect \(aspect) stays inside inset usable screen")
try require(close(frame.maxX, usableScreen.maxX - 16) && close(frame.minY, usableScreen.minY + 16),
"aspect \(aspect) stays anchored bottom right")
try require(close(frame.maxX, usableScreen.maxX - 16) && close(frame.maxY, usableScreen.maxY - 16),
"aspect \(aspect) stays anchored top right")
}
let smallScreen = NSRect(x: 0, y: 0, width: 300, height: 400)
let bounded = CompactWindowController.initialFrame(aspect: 16.0 / 9.0, visibleFrame: smallScreen)
try require(sameFrame(bounded, NSRect(x: 16, y: 16, width: 268, height: 150.75)),
try require(sameFrame(bounded, NSRect(x: 16, y: 233.25, width: 268, height: 150.75)),
"target width shrinks to usable bounds without distorting ordinary aspect")
}
@@ -171,9 +171,9 @@ struct CompactWindowChecks {
let visible = (window.screen ?? screen).visibleFrame
try require(close(window.frame.maxX, visible.maxX - 16)
&& close(window.frame.minY, visible.minY + 16)
&& close(window.frame.maxY, visible.maxY - 16)
&& close(window.frame.width / window.frame.height, 16.0 / 9.0),
"actual compact window enters at inset bottom right with playback aspect")
"actual compact window enters at inset top right with playback aspect")
let nearEdge = NSRect(x: visible.minX + 26, y: visible.minY + 27,
width: window.frame.width, height: window.frame.height)
window.setFrame(nearEdge, display: false)