From 9aa0905c10dcf2c9152b0cca7805070b111a6bb2 Mon Sep 17 00:00:00 2001 From: Akemi Date: Sun, 10 Feb 2019 17:20:01 +0100 Subject: 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. --- video/out/cocoa_cb_common.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index 305766c9f6..d5cc9671af 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -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) { 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 { -- cgit v1.2.3