diff options
author | Akemi <der.richter@gmx.de> | 2018-06-09 20:10:25 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2018-06-12 01:57:34 +0300 |
commit | cd893626cbab0e55ca9f9a5ef384532e978fe702 (patch) | |
tree | a5c426bb96fefff83a1854cdbea6acaff1385ff4 /video/out | |
parent | 2e7a4f717c27251e95f2f50612035dc080c874be (diff) |
cocoa-cb: fix building with Swift 4.2
init is a reserved keyword and Swift 4.2 got a bit stricter about using
it. this could be fixed by adding apostrophes around init but makes the
code uglier. hence i just renamed init to initialized and for
consistency uninit to uninitialized.
Fixes #5899
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/cocoa-cb/video_layer.swift | 2 | ||||
-rw-r--r-- | video/out/cocoa_cb_common.swift | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/video/out/cocoa-cb/video_layer.swift b/video/out/cocoa-cb/video_layer.swift index c600b06b6c..b3893273b1 100644 --- a/video/out/cocoa-cb/video_layer.swift +++ b/video/out/cocoa-cb/video_layer.swift @@ -89,7 +89,7 @@ class VideoLayer: CAOpenGLLayer { if inLiveResize == false { isAsynchronous = false } - return mpv != nil && cocoaCB.backendState == .init + return mpv != nil && cocoaCB.backendState == .initialized } override func draw(inCGLContext ctx: CGLContextObj, diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index e6705902c4..a4aae9ff2a 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -35,11 +35,11 @@ class CocoaCB: NSObject { } enum State { - case uninit + case uninitialized case needsInit - case `init` + case initialized } - var backendState: State = .uninit + var backendState: State = .uninitialized let eventsLock = NSLock() var events: Int = 0 @@ -58,7 +58,7 @@ class CocoaCB: NSObject { } func preinit(_ vo: UnsafeMutablePointer<vo>) { - if backendState == .uninit { + if backendState == .uninitialized { backendState = .needsInit if let app = NSApp as? Application { @@ -122,7 +122,7 @@ class CocoaCB: NSObject { window.isMovableByWindowBackground = true } - backendState = .init + backendState = .initialized } func updateWindowSize(_ vo: UnsafeMutablePointer<vo>) { @@ -476,7 +476,7 @@ class CocoaCB: NSObject { } shutdown() case MPV_EVENT_PROPERTY_CHANGE: - if backendState == .init { + if backendState == .initialized { handlePropertyChange(event) } default: |