summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa-cb/title_bar.swift
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2019-07-20 12:16:37 +0200
committerJan Ekström <jeebjp@gmail.com>2019-07-21 18:13:07 +0300
commita8c2e2986838dccbcc4bd218b501f0bf86b36e2c (patch)
tree0f9ce3f16cc72c47dd70e9961e6c9b9f1cdabd43 /video/out/cocoa-cb/title_bar.swift
parent0602f082cb9775b4c9c8e256b1cb9de218a3b5fc (diff)
downloadmpv-a8c2e2986838dccbcc4bd218b501f0bf86b36e2c.tar.bz2
mpv-a8c2e2986838dccbcc4bd218b501f0bf86b36e2c.tar.xz
cocoa-cb: migrate to swift 5 with swift 4 fallback
this migrates our current swift code to version 5 and 4. building is support from 10.12.6 and xcode 9.1 onwards. dynamic linking is the new default, since Apple removed static libs from their new toolchains and it's the recommended way. additionally the found macOS SDK version is printed since it's an important information for finding possible errors now. Fixes #6470
Diffstat (limited to 'video/out/cocoa-cb/title_bar.swift')
-rw-r--r--video/out/cocoa-cb/title_bar.swift22
1 files changed, 11 insertions, 11 deletions
diff --git a/video/out/cocoa-cb/title_bar.swift b/video/out/cocoa-cb/title_bar.swift
index f5979c71e9..f961b1908a 100644
--- a/video/out/cocoa-cb/title_bar.swift
+++ b/video/out/cocoa-cb/title_bar.swift
@@ -29,7 +29,7 @@ class TitleBar: NSVisualEffectView {
get { return NSWindow.frameRect(forContentRect: CGRect.zero, styleMask: .titled).size.height }
}
var buttons: [NSButton] {
- get { return ([.closeButton, .miniaturizeButton, .zoomButton] as [NSWindowButton]).flatMap { cocoaCB.window?.standardWindowButton($0) } }
+ get { return ([.closeButton, .miniaturizeButton, .zoomButton] as [NSWindow.ButtonType]).compactMap { cocoaCB.window?.standardWindowButton($0) } }
}
override var material: NSVisualEffectView.Material {
@@ -57,7 +57,7 @@ class TitleBar: NSVisualEffectView {
super.init(frame: f)
alphaValue = 0
blendingMode = .withinWindow
- autoresizingMask = [.viewWidthSizable, .viewMinYMargin]
+ autoresizingMask = [.width, .minYMargin]
systemBar?.alphaValue = 0
state = .followsWindowActiveState
wantsLayer = true
@@ -148,7 +148,7 @@ class TitleBar: NSVisualEffectView {
}
}
- func hide() {
+ @objc func hide() {
guard let window = cocoaCB.window else { return }
if window.isInFullscreen && !window.isAnimating {
alphaValue = 0
@@ -175,26 +175,26 @@ class TitleBar: NSVisualEffectView {
func appearanceFrom(string: String) -> NSAppearance? {
switch string {
case "1", "aqua":
- return NSAppearance(named: NSAppearanceNameAqua)
+ return NSAppearance(named: .aqua)
case "3", "vibrantLight":
- return NSAppearance(named: NSAppearanceNameVibrantLight)
+ return NSAppearance(named: .vibrantLight)
case "4", "vibrantDark":
- return NSAppearance(named: NSAppearanceNameVibrantDark)
+ return NSAppearance(named: .vibrantDark)
default: break
}
if #available(macOS 10.14, *) {
switch string {
case "2", "darkAqua":
- return NSAppearance(named: NSAppearanceNameDarkAqua)
+ return NSAppearance(named: .darkAqua)
case "5", "aquaHighContrast":
- return NSAppearance(named: NSAppearanceNameAccessibilityHighContrastAqua)
+ return NSAppearance(named: .accessibilityHighContrastAqua)
case "6", "darkAquaHighContrast":
- return NSAppearance(named: NSAppearanceNameAccessibilityHighContrastDarkAqua)
+ return NSAppearance(named: .accessibilityHighContrastDarkAqua)
case "7", "vibrantLightHighContrast":
- return NSAppearance(named: NSAppearanceNameAccessibilityHighContrastVibrantLight)
+ return NSAppearance(named: .accessibilityHighContrastVibrantLight)
case "8", "vibrantDarkHighContrast":
- return NSAppearance(named: NSAppearanceNameAccessibilityHighContrastVibrantDark)
+ return NSAppearance(named: .accessibilityHighContrastVibrantDark)
case "0", "auto": fallthrough
default:
return nil