diff options
author | der richter <der.richter@gmx.de> | 2023-11-08 01:26:29 +0100 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2023-11-10 14:30:32 +0100 |
commit | a54cc02341fed3e1e2408a692aa4753718ee969f (patch) | |
tree | 0b4fb98ee72c5543ca226ed2bcc29d425aafc1d6 /osdep | |
parent | 040a921964fd64f310b95f35af88f3d805bba684 (diff) | |
download | mpv-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 'osdep')
-rw-r--r-- | osdep/macos/swift_extensions.swift | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/osdep/macos/swift_extensions.swift b/osdep/macos/swift_extensions.swift index a1aeb0abf7..127c568abe 100644 --- a/osdep/macos/swift_extensions.swift +++ b/osdep/macos/swift_extensions.swift @@ -28,37 +28,6 @@ extension NSScreen { return deviceDescription[.screenNumber] as? CGDirectDisplayID ?? 0 } } - - public var displayName: String? { - get { - var name: String? = nil - var object: io_object_t - var iter = io_iterator_t() - let matching = IOServiceMatching("IODisplayConnect") - let result = IOServiceGetMatchingServices(kIOMasterPortDefault, matching, &iter) - - if result != KERN_SUCCESS || iter == 0 { return nil } - - repeat { - object = IOIteratorNext(iter) - if let info = IODisplayCreateInfoDictionary(object, IOOptionBits(kIODisplayOnlyPreferredName)).takeRetainedValue() as? [String:AnyObject], - (info[kDisplayVendorID] as? UInt32 == CGDisplayVendorNumber(displayID) && - info[kDisplayProductID] as? UInt32 == CGDisplayModelNumber(displayID) && - info[kDisplaySerialNumber] as? UInt32 ?? 0 == CGDisplaySerialNumber(displayID)) - { - if let productNames = info["DisplayProductName"] as? [String:String], - let productName = productNames.first?.value - { - name = productName - break - } - } - } while object != 0 - - IOObjectRelease(iter) - return name - } - } } extension NSColor { |