0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

cocoa-cb: report actual unfs window size for current window scale

This commit is contained in:
der richter 2020-03-21 13:48:23 +01:00
parent 71295fb872
commit 4deae5e4b5
2 changed files with 15 additions and 0 deletions

View File

@ -497,6 +497,10 @@ class Window: NSWindow, NSWindowDelegate {
func windowDidEndLiveResize(_ notification: Notification) {
cocoaCB.layer?.inLiveResize = false
cocoaCB.mpv?.setConfigProperty(maximized: isZoomed)
if let contentViewFrame = contentView?.frame, !isAnimating {
unfsContentFrame = convertToScreen(contentViewFrame)
}
}
func windowShouldClose(_ sender: NSWindow) -> Bool {

View File

@ -516,6 +516,17 @@ class CocoaCB: NSObject {
return VO_TRUE
}
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:
if let sizeData = data?.assumingMemoryBound(to: Int32.self) {
let size = UnsafeBufferPointer(start: sizeData, count: 2)