Unified · Split
| @@ -109,6 +109,10 @@ class MacCommon: Common { · 108 unmodified lines | ||
| 109 | 109 | info.pointee.last_queue_display_time = next?.time ?? -1 |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | + @objc func isVisible() -> Bool { | |
| 113 | + return window?.occlusionState.contains(.visible) ?? false | |
| 114 | + } | |
| 115 | + | |
| 112 | 116 | override func displayLinkCallback(_ displayLink: CVDisplayLink, |
| 113 | 117 | _ inNow: UnsafePointer<CVTimeStamp>, |
| 114 | 118 | _ inOutputTime: UnsafePointer<CVTimeStamp>, |
| @@ -55,6 +55,12 @@ static int mac_vk_color_depth(struct ra_ctx *ctx) · 54 unmodified lines | ||
| 55 | 55 | return 0; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | +static bool mac_vk_check_visible(struct ra_ctx *ctx) | |
| 59 | +{ | |
| 60 | + struct priv *p = ctx->priv; | |
| 61 | + return [p->vo_mac isVisible]; | |
| 62 | +} | |
| 63 | + | |
| 58 | 64 | static bool mac_vk_init(struct ra_ctx *ctx) |
| 59 | 65 | { |
| 60 | 66 | struct priv *p = ctx->priv = talloc_zero(ctx, struct priv); |
| @@ -84,6 +90,7 @@ static bool mac_vk_init(struct ra_ctx *ctx) · 23 unmodified lines | ||
| 84 | 90 | .swap_buffers = mac_vk_swap_buffers, |
| 85 | 91 | .get_vsync = mac_vk_get_vsync, |
| 86 | 92 | .color_depth = mac_vk_color_depth, |
| 93 | + .check_visible = mac_vk_check_visible, | |
| 87 | 94 | }; |
| 88 | 95 | |
| 89 | 96 | VkInstance inst = vk->vkinst->instance; |