Restore last player window frame when auto-resize is off

With auto-resize disabled the separate player window opened at a
computed 16:9 default and was never corrected, so non-16:9 videos sat
letterboxed until a manual resize. Persist the window frame via
NSWindow frame autosave and restore it on open when auto-resize is
off, so the window reopens exactly as the user last left it.
This commit is contained in:
Arkadiusz Fal
2026-07-18 16:21:12 +02:00
parent e905932cfa
commit bc7b00dfb3

View File

@@ -56,6 +56,7 @@ final class ExpandedPlayerWindowManager: NSObject {
private static let maxScreenRatio: CGFloat = 0.7
private static let targetVideoHeight: CGFloat = 720
private static let defaultAspectRatio: Double = 16.0 / 9.0
private static let frameAutosaveName = "ExpandedPlayerWindow"
var isPresented: Bool {
playerWindow != nil
@@ -185,6 +186,17 @@ final class ExpandedPlayerWindowManager: NSObject {
// Center window on screen
window.center()
// With auto-resize off, the window must reopen exactly as the user last
// left it no fitting, no centering. Restore the persisted frame over
// the computed default (no-op when nothing was saved yet, e.g. first
// open). With auto-resize on, sizing is owned by resizeToFitAspectRatio.
if !appEnvironment.settingsManager.playerSheetAutoResize {
window.setFrameUsingName(Self.frameAutosaveName)
}
// Persist every later frame change (manual resize/move, auto-fit) so the
// next open with auto-resize off can restore it.
_ = window.setFrameAutosaveName(Self.frameAutosaveName)
// Store reference
self.playerWindow = window