mirror of https://github.com/mpv-player/mpv
cocoa-cb: report actual unfs window size for current window scale
This commit is contained in:
parent
71295fb872
commit
4deae5e4b5
|
@ -497,6 +497,10 @@ class Window: NSWindow, NSWindowDelegate {
|
||||||
func windowDidEndLiveResize(_ notification: Notification) {
|
func windowDidEndLiveResize(_ notification: Notification) {
|
||||||
cocoaCB.layer?.inLiveResize = false
|
cocoaCB.layer?.inLiveResize = false
|
||||||
cocoaCB.mpv?.setConfigProperty(maximized: isZoomed)
|
cocoaCB.mpv?.setConfigProperty(maximized: isZoomed)
|
||||||
|
|
||||||
|
if let contentViewFrame = contentView?.frame, !isAnimating {
|
||||||
|
unfsContentFrame = convertToScreen(contentViewFrame)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowShouldClose(_ sender: NSWindow) -> Bool {
|
func windowShouldClose(_ sender: NSWindow) -> Bool {
|
||||||
|
|
|
@ -516,6 +516,17 @@ class CocoaCB: NSObject {
|
||||||
return VO_TRUE
|
return VO_TRUE
|
||||||
}
|
}
|
||||||
return VO_FALSE
|
return VO_FALSE
|
||||||
|
case VOCTRL_GET_UNFS_WINDOW_SIZE:
|
||||||
|
let sizeData = data?.assumingMemoryBound(to: Int32.self)
|
||||||
|
let size = UnsafeMutableBufferPointer(start: sizeData, count: 2)
|
||||||
|
var rect = ccb.window?.unfsContentFrame ?? NSRect(x: 0, y: 0, width: 1280, height: 720)
|
||||||
|
if let screen = ccb.window?.currentScreen, !Bool(ccb.mpv?.opts.hidpi_window_scale ?? 0) {
|
||||||
|
rect = screen.convertRectToBacking(rect)
|
||||||
|
}
|
||||||
|
|
||||||
|
size[0] = Int32(rect.size.width)
|
||||||
|
size[1] = Int32(rect.size.height)
|
||||||
|
return VO_TRUE
|
||||||
case VOCTRL_SET_UNFS_WINDOW_SIZE:
|
case VOCTRL_SET_UNFS_WINDOW_SIZE:
|
||||||
if let sizeData = data?.assumingMemoryBound(to: Int32.self) {
|
if let sizeData = data?.assumingMemoryBound(to: Int32.self) {
|
||||||
let size = UnsafeBufferPointer(start: sizeData, count: 2)
|
let size = UnsafeBufferPointer(start: sizeData, count: 2)
|
||||||
|
|
Loading…
Reference in New Issue