mac/common: add support for transparent rendering

this adds support for possible transparent rendering by setting the
window and layer background to transparent.

NOTE: atm only possible with libplacebo master.
This commit is contained in:
der richter committed 2026-01-11 13:48:58 +01:00
1 parent 9aebe4cb01
commit ce694c1eba
2 files changed
+5

No files matched your search

+1
View File
@@ -84,6 +84,7 @@ class MetalLayer: CAMetalLayer {
let isForced = newValue == wantsAlpha
if isOpaque == wantsAlpha || isForced {
super.isOpaque = !wantsAlpha
backgroundColor = (wantsAlpha ? NSColor.clear : NSColor.black).cgColor
log.verbose("Metal layer is opaque (direct-to-display possible): \(isOpaque)" + (isForced ? " (forced)" : ""))
}
}
+4
View File
@@ -117,6 +117,10 @@ class MacCommon: Common {
@objc func update(alpha: Bool) {
layer?.wantsAlpha = alpha
DispatchQueue.main.sync {
window?.isOpaque = !alpha
window?.backgroundColor = alpha ? NSColor.clear : nil
}
}
override func displayLinkCallback(_ displayLink: CVDisplayLink,