summaryrefslogtreecommitdiffstats
path: root/osdep/mac/app_hub.swift
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/mac/app_hub.swift')
-rw-r--r--osdep/mac/app_hub.swift11
1 files changed, 9 insertions, 2 deletions
diff --git a/osdep/mac/app_hub.swift b/osdep/mac/app_hub.swift
index 60854a3b91..fe5160cf51 100644
--- a/osdep/mac/app_hub.swift
+++ b/osdep/mac/app_hub.swift
@@ -28,6 +28,9 @@ class AppHub: NSObject {
#if HAVE_MACOS_TOUCHBAR
@objc var touchBar: TouchBar?
#endif
+#if HAVE_MACOS_COCOA_CB
+ var cocoaCb: CocoaCB?
+#endif
var isApplication: Bool { get { NSApp is Application } }
@@ -57,8 +60,12 @@ class AppHub: NSObject {
}
@objc func initCocoaCb() {
- guard let app = NSApp as? Application, let mpv = mpv else { return }
- DispatchQueue.main.sync { app.initCocoaCb(mpv) }
+#if HAVE_MACOS_COCOA_CB
+ if !isApplication { return }
+ DispatchQueue.main.sync {
+ self.cocoaCb = self.cocoaCb ?? CocoaCB(mpv_create_client(mpv, "cocoacb"))
+ }
+#endif
}
@objc func startRemote() {