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
This commit is contained in:
Akemi 2018-06-09 20:10:25 +02:00 committed by Jan Ekström
parent 2e7a4f717c
commit cd893626cb
2 changed files with 7 additions and 7 deletions

View File

@ -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,

View File

@ -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: