mirror of https://github.com/mpv-player/mpv
mac: update geometry/autofit opts on runtime
This commit is contained in:
parent
e832f4969f
commit
fa4ca16f66
|
@ -553,6 +553,14 @@ class Common: NSObject {
|
|||
DispatchQueue.main.async {
|
||||
self.window?.setMaximized(Bool(mpv.opts.window_maximized))
|
||||
}
|
||||
case MPVHelper.getPointer(&mpv.optsPtr.pointee.geometry): fallthrough
|
||||
case MPVHelper.getPointer(&mpv.optsPtr.pointee.autofit): fallthrough
|
||||
case MPVHelper.getPointer(&mpv.optsPtr.pointee.autofit_smaller): fallthrough
|
||||
case MPVHelper.getPointer(&mpv.optsPtr.pointee.autofit_larger):
|
||||
DispatchQueue.main.async {
|
||||
let (_, _, wr) = self.getInitProperties(vo)
|
||||
self.window?.updateFrame(wr)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
|
@ -342,21 +342,19 @@ class Window: NSWindow, NSWindowDelegate {
|
|||
|
||||
func updateFrame(_ rect: NSRect) {
|
||||
if rect != frame {
|
||||
let cRect = frameRect(forContentRect: rect)
|
||||
unfsContentFrame = rect
|
||||
if !isInFullscreen {
|
||||
let cRect = frameRect(forContentRect: rect)
|
||||
setFrame(cRect, display: true)
|
||||
common.windowDidUpdateFrame()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateSize(_ size: NSSize) {
|
||||
if let currentSize = contentView?.frame.size, size != currentSize {
|
||||
let newContentFrame = centeredContentSize(for: frame, size: size)
|
||||
if !isInFullscreen {
|
||||
updateFrame(newContentFrame)
|
||||
} else {
|
||||
unfsContentFrame = newContentFrame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue