summaryrefslogtreecommitdiffstats
path: root/video/out/mac/common.swift
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2023-11-08 01:26:29 +0100
committerder richter <der.richter@gmx.de>2023-11-10 14:30:32 +0100
commita54cc02341fed3e1e2408a692aa4753718ee969f (patch)
tree0b4fb98ee72c5543ca226ed2bcc29d425aafc1d6 /video/out/mac/common.swift
parent040a921964fd64f310b95f35af88f3d805bba684 (diff)
downloadmpv-a54cc02341fed3e1e2408a692aa4753718ee969f.tar.bz2
mpv-a54cc02341fed3e1e2408a692aa4753718ee969f.tar.xz
mac: change display name retrieval to localizedName NSScreen property
the old displayName property via the IODisplay API is not working anymore on ARM based macs and was broken in at least one other case. instead we use the new localizedName property introduced in 10.15 of the NSScreen. we don't need any backwards compatibility since 10.15 is the oldest version we support now. configs and scripts that use the options and properties fs-screen-name, screen-name or display-names need to be adjusted since the names could differ from the previous implementation via the IODisplay API. Fixes #9697
Diffstat (limited to 'video/out/mac/common.swift')
-rw-r--r--video/out/mac/common.swift4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/mac/common.swift b/video/out/mac/common.swift
index 6da99ca20b..aac705005f 100644
--- a/video/out/mac/common.swift
+++ b/video/out/mac/common.swift
@@ -396,7 +396,7 @@ class Common: NSObject {
func getScreenBy(name screenName: String?) -> NSScreen? {
for screen in NSScreen.screens {
- if screen.displayName == screenName {
+ if screen.localizedName == screenName {
return screen
}
}
@@ -628,7 +628,7 @@ class Common: NSObject {
let dnames = data!.assumingMemoryBound(to: UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>?.self)
var array: UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>? = nil
var count: Int32 = 0
- let displayName = getCurrentScreen()?.displayName ?? "Unknown"
+ let displayName = getCurrentScreen()?.localizedName ?? "Unknown"
SWIFT_TARRAY_STRING_APPEND(nil, &array, &count, ta_xstrdup(nil, displayName))
SWIFT_TARRAY_STRING_APPEND(nil, &array, &count, nil)