summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
Diffstat (limited to 'video/out')
-rw-r--r--video/out/cocoa-cb/title_bar.swift16
-rw-r--r--video/out/cocoa_cb_common.swift4
2 files changed, 20 insertions, 0 deletions
diff --git a/video/out/cocoa-cb/title_bar.swift b/video/out/cocoa-cb/title_bar.swift
index e9109d4a2b..8a7bf30f02 100644
--- a/video/out/cocoa-cb/title_bar.swift
+++ b/video/out/cocoa-cb/title_bar.swift
@@ -62,12 +62,14 @@ class TitleBar: NSVisualEffectView {
autoresizingMask = [.viewWidthSizable, .viewMinYMargin]
systemBar.alphaValue = 0
state = .followsWindowActiveState
+ wantsLayer = true
window.contentView!.addSubview(self, positioned: .above, relativeTo: nil)
window.titlebarAppearsTransparent = true
window.styleMask.insert(.fullSizeContentView)
set(appearance: Int(mpv.macOpts!.macos_title_bar_appearance))
set(material: Int(mpv.macOpts!.macos_title_bar_material))
+ set(color: mpv.macOpts!.macos_title_bar_color)
}
// catch these events so they are not propagated to the underlying view
@@ -108,6 +110,20 @@ class TitleBar: NSVisualEffectView {
}
}
+ func set(color: Any) {
+ if color is String {
+ layer?.backgroundColor = NSColor(hex: color as! String).cgColor
+ } else {
+ let col = color as! m_color
+ let red = CGFloat(col.r)/255
+ let green = CGFloat(col.g)/255
+ let blue = CGFloat(col.b)/255
+ let alpha = CGFloat(col.a)/255
+ layer?.backgroundColor = NSColor(calibratedRed: red, green: green,
+ blue: blue, alpha: alpha).cgColor
+ }
+ }
+
func show() {
if (!cocoaCB.window.border && !cocoaCB.window.isInFullscreen) { return }
let loc = cocoaCB.view.convert(cocoaCB.window.mouseLocationOutsideOfEventStream, from: nil)
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift
index a3fabd0324..f545e72a3d 100644
--- a/video/out/cocoa_cb_common.swift
+++ b/video/out/cocoa_cb_common.swift
@@ -521,6 +521,10 @@ class CocoaCB: NSObject {
if let data = MPVHelper.mpvStringArrayToString(property.data) {
titleBar.set(material: data)
}
+ case "macos-title-bar-color":
+ if let data = MPVHelper.mpvStringArrayToString(property.data) {
+ titleBar.set(color: data)
+ }
default:
break
}