cocoa-cb: fix Space switching when quitting fs

when quitting mpv in fullscreen the System always switchs to Space 1
regardless of which Space mpv was on previous to switching to fs. to fix
this we close the window before quitting fs. that way the System
switches back the the Space mpv was previous on before fs.
This commit is contained in:
Akemi 2019-02-10 17:20:01 +01:00 committed by Jan Ekström
parent 0caaa1a37c
commit 9aa0905c10
1 changed files with 6 additions and 4 deletions

View File

@ -459,6 +459,12 @@ class CocoaCB: NSObject {
}
func shutdown(_ destroy: Bool = false) {
isShuttingDown = window?.isAnimating ?? false || window?.isInFullscreen ?? false
if window?.isInFullscreen ?? false && !(window?.isAnimating ?? false) {
window.close()
}
if isShuttingDown { return }
setCursorVisiblility(true)
stopDisplaylink()
uninitLightSensor()
@ -476,10 +482,6 @@ class CocoaCB: NSObject {
func processEvent(_ event: UnsafePointer<mpv_event>) {
switch event.pointee.event_id {
case MPV_EVENT_SHUTDOWN:
if window != nil && window.isAnimating {
isShuttingDown = true
return
}
shutdown()
case MPV_EVENT_PROPERTY_CHANGE:
if backendState == .initialized {