diff --git a/video/out/mac_common.swift b/video/out/mac_common.swift index db1a12866e..8e48d0f513 100644 --- a/video/out/mac_common.swift +++ b/video/out/mac_common.swift @@ -109,6 +109,10 @@ class MacCommon: Common { info.pointee.last_queue_display_time = next?.time ?? -1 } + @objc func isVisible() -> Bool { + return window?.occlusionState.contains(.visible) ?? false + } + override func displayLinkCallback(_ displayLink: CVDisplayLink, _ inNow: UnsafePointer, _ inOutputTime: UnsafePointer, diff --git a/video/out/vulkan/context_mac.m b/video/out/vulkan/context_mac.m index 18b928aa52..281a4bdf2f 100644 --- a/video/out/vulkan/context_mac.m +++ b/video/out/vulkan/context_mac.m @@ -55,6 +55,12 @@ static int mac_vk_color_depth(struct ra_ctx *ctx) return 0; } +static bool mac_vk_check_visible(struct ra_ctx *ctx) +{ + struct priv *p = ctx->priv; + return [p->vo_mac isVisible]; +} + static bool mac_vk_init(struct ra_ctx *ctx) { struct priv *p = ctx->priv = talloc_zero(ctx, struct priv); @@ -84,6 +90,7 @@ static bool mac_vk_init(struct ra_ctx *ctx) .swap_buffers = mac_vk_swap_buffers, .get_vsync = mac_vk_get_vsync, .color_depth = mac_vk_color_depth, + .check_visible = mac_vk_check_visible, }; VkInstance inst = vk->vkinst->instance;