diff options
Diffstat (limited to 'osdep/mac/swift_compat.swift')
-rw-r--r-- | osdep/mac/swift_compat.swift | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/osdep/mac/swift_compat.swift b/osdep/mac/swift_compat.swift index 83059dae5c..24365cdd4a 100644 --- a/osdep/mac/swift_compat.swift +++ b/osdep/mac/swift_compat.swift @@ -15,6 +15,15 @@ * License along with mpv. If not, see <http://www.gnu.org/licenses/>. */ +#if !swift(>=5.7) +extension NSCondition { + func withLock<R>(_ body: () throws -> R) rethrows -> R { + self.lock() + defer { self.unlock() } + return try body() + } +} +#endif #if !swift(>=5.0) extension Data { @@ -30,7 +39,15 @@ extension Data { #if !swift(>=4.2) extension NSDraggingInfo { var draggingPasteboard: NSPasteboard { - get { return draggingPasteboard() } + return draggingPasteboard() } } #endif + +#if !HAVE_MACOS_12_FEATURES && HAVE_MACOS_11_FEATURES +@available(macOS 11.0, *) +extension CGColorSpace { + static let itur_2100_HLG: CFString = kCGColorSpaceITUR_2100_HLG + static let itur_2100_PQ: CFString = kCGColorSpaceITUR_2100_PQ +} +#endif |