diff --git a/video/out/mac/common.swift b/video/out/mac/common.swift index 8e7aab75ec..7b6fa48b5d 100644 --- a/video/out/mac/common.swift +++ b/video/out/mac/common.swift @@ -23,7 +23,7 @@ class Common: NSObject { var log: LogHelper let queue: DispatchQueue = DispatchQueue(label: "io.mpv.queue") - var window: Window? + @objc var window: Window? var view: View? var titleBar: TitleBar? diff --git a/video/out/mac/window.swift b/video/out/mac/window.swift index 8a8c56c76a..0829205da4 100644 --- a/video/out/mac/window.swift +++ b/video/out/mac/window.swift @@ -35,7 +35,7 @@ class Window: NSWindow, NSWindowDelegate { let animationLock: NSCondition = NSCondition() var unfsContentFramePixel: NSRect { get { return convertToBacking(unfsContentFrame ?? NSRect(x: 0, y: 0, width: 160, height: 90)) } } - var framePixel: NSRect { get { return convertToBacking(frame) } } + @objc var framePixel: NSRect { get { return convertToBacking(frame) } } var keepAspect: Bool = true { didSet { diff --git a/video/out/mac_common.swift b/video/out/mac_common.swift index 211c535811..71659de8e5 100644 --- a/video/out/mac_common.swift +++ b/video/out/mac_common.swift @@ -93,12 +93,6 @@ class MacCommon: Common { } } - func updateRenderSize(_ size: NSSize) { - mpv?.vo.pointee.dwidth = Int32(size.width) - mpv?.vo.pointee.dheight = Int32(size.height) - flagEvents(VO_EVENT_RESIZE | VO_EVENT_EXPOSE) - } - override func displayLinkCallback(_ displayLink: CVDisplayLink, _ inNow: UnsafePointer, _ inOutputTime: UnsafePointer, @@ -144,12 +138,7 @@ class MacCommon: Common { } override func windowDidResize() { - guard let window = window else { - log.sendWarning("No window available on window resize event") - return - } - - updateRenderSize(window.framePixel.size) + flagEvents(VO_EVENT_RESIZE | VO_EVENT_EXPOSE) } override func windowDidChangeScreenProfile() { diff --git a/video/out/vulkan/context_mac.m b/video/out/vulkan/context_mac.m index 38b34ff029..5621e6dca3 100644 --- a/video/out/vulkan/context_mac.m +++ b/video/out/vulkan/context_mac.m @@ -85,7 +85,14 @@ error: static bool resize(struct ra_ctx *ctx) { - return ra_vk_ctx_resize(ctx, ctx->vo->dwidth, ctx->vo->dheight); + struct priv *p = ctx->priv; + + if (!p->vo_mac.window) { + return false; + } + CGSize size = p->vo_mac.window.framePixel.size; + + return ra_vk_ctx_resize(ctx, (int)size.width, (int)size.height); } static bool mac_vk_reconfig(struct ra_ctx *ctx)