diff options
author | Akemi <der.richter@gmx.de> | 2018-03-16 13:52:15 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-03-18 12:11:10 -0700 |
commit | af7b412d1c0b74c63d4d301f5cc5cb2cd32c2108 (patch) | |
tree | 49db707141780893a9417be3fb7d1f4edafc3aa3 /video | |
parent | fbcf2bf207b45ca9dfb79cad6d0dc981385221a5 (diff) | |
download | mpv-af7b412d1c0b74c63d4d301f5cc5cb2cd32c2108.tar.bz2 mpv-af7b412d1c0b74c63d4d301f5cc5cb2cd32c2108.tar.xz |
cocoa-cb: fix shutdown when fullscreen animation is running
commit 2edf00f changed the MPV_EVENT_SHUTDOWN behaviour slightly, such
that it will only be sent once. cocoa-cb relied on it being sent
continuously till all mpv_handles are destroyed. now it manually shuts
down and destroys the mpv_handle after the animation instead of relying
on this removed behaviour.
Diffstat (limited to 'video')
-rw-r--r-- | video/out/cocoa-cb/window.swift | 2 | ||||
-rw-r--r-- | video/out/cocoa_cb_common.swift | 22 |
2 files changed, 17 insertions, 7 deletions
diff --git a/video/out/cocoa-cb/window.swift b/video/out/cocoa-cb/window.swift index 040cd47751..b296eb25c8 100644 --- a/video/out/cocoa-cb/window.swift +++ b/video/out/cocoa-cb/window.swift @@ -306,7 +306,7 @@ class Window: NSWindow, NSWindowDelegate { isAnimating = false cocoaCB.layer.neededFlips += 1 - cocoaCB.isShuttingDown = false + cocoaCB.checkShutdown() } func setToFullScreen() { diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index b5ba9ee0c8..e8d8bb44f4 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -452,6 +452,21 @@ class CocoaCB: NSObject { } } + func shutdown(_ destroy: Bool = false) { + setCursorVisiblility(true) + stopDisplaylink() + uninitLightSensor() + removeDisplayReconfigureObserver() + mpv.deinitRender() + mpv.deinitMPV(destroy) + } + + func checkShutdown() { + if isShuttingDown { + shutdown(true) + } + } + func processEvent(_ event: UnsafePointer<mpv_event>) { switch event.pointee.event_id { case MPV_EVENT_SHUTDOWN: @@ -459,12 +474,7 @@ class CocoaCB: NSObject { isShuttingDown = true return } - setCursorVisiblility(true) - stopDisplaylink() - uninitLightSensor() - removeDisplayReconfigureObserver() - mpv.deinitRender() - mpv.deinitMPV() + shutdown() case MPV_EVENT_PROPERTY_CHANGE: if backendState == .init { handlePropertyChange(event) |