mac: add support for --auto-window-resize option

Fixes #9325
This commit is contained in:
der richter 2023-12-19 20:55:04 +01:00
parent fa4ca16f66
commit 0d47e48437
3 changed files with 4 additions and 3 deletions

View File

@ -3400,7 +3400,6 @@ Window
be the default behavior. Currently only affects X11 and SDL VOs. be the default behavior. Currently only affects X11 and SDL VOs.
``--auto-window-resize=<yes|no>`` ``--auto-window-resize=<yes|no>``
(Wayland, Win32, and X11)
By default, mpv will automatically resize itself if the video's size changes By default, mpv will automatically resize itself if the video's size changes
(i.e. advancing forward in a playlist). Setting this to ``no`` disables this (i.e. advancing forward in a playlist). Setting this to ``no`` disables this
behavior so the window size never changes automatically. This option does behavior so the window size never changes automatically. This option does

View File

@ -64,7 +64,7 @@ class CocoaCB: Common {
mpv?.vo = vo mpv?.vo = vo
if backendState == .needsInit { if backendState == .needsInit {
DispatchQueue.main.sync { self.initBackend(vo) } DispatchQueue.main.sync { self.initBackend(vo) }
} else { } else if mpv?.opts.auto_window_resize ?? true {
DispatchQueue.main.async { DispatchQueue.main.async {
self.updateWindowSize(vo) self.updateWindowSize(vo)
self.layer?.update(force: true) self.layer?.update(force: true)

View File

@ -58,7 +58,9 @@ class MacCommon: Common {
initWindowState() initWindowState()
} }
if !NSEqualSizes(window?.unfsContentFramePixel.size ?? NSZeroSize, wr.size) { if !NSEqualSizes(window?.unfsContentFramePixel.size ?? NSZeroSize, wr.size) &&
mpv?.opts.auto_window_resize ?? true
{
window?.updateSize(wr.size) window?.updateSize(wr.size)
} }