summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2020-03-06 17:31:23 +0100
committerder richter <der.richter@gmx.de>2020-03-14 12:23:42 +0100
commitcd22e93feed9e84ebe36e98ac59cc744df07b64a (patch)
treeff97af79c4c0b1643f217f7726d7aa1b033e9b22
parentc78482045444c488bb7948305d583a55d17cd236 (diff)
downloadmpv-cd22e93feed9e84ebe36e98ac59cc744df07b64a.tar.bz2
mpv-cd22e93feed9e84ebe36e98ac59cc744df07b64a.tar.xz
cocoa-cb: support maximize/minimize on startup
Allow the --window-maximized and --window-minimized flags to actually work when the player is started. since macOS doesn't like using both at the same time the minimized state takes precedence over the maximized state.
-rw-r--r--video/out/cocoa_cb_common.swift10
1 files changed, 9 insertions, 1 deletions
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift
index 7fc4d0c0ea..c50147ffca 100644
--- a/video/out/cocoa_cb_common.swift
+++ b/video/out/cocoa_cb_common.swift
@@ -128,10 +128,18 @@ class CocoaCB: NSObject {
titleBar = TitleBar(frame: wr, window: window, cocoaCB: self)
+ let minimized = Bool(opts.window_minimized)
window.isRestorable = false
window.isReleasedWhenClosed = false
+ window.setMaximized(minimized ? false : Bool(opts.window_maximized))
+ window.setMinimized(minimized)
window.makeMain()
- window.makeKeyAndOrderFront(nil)
+ window.makeKey()
+
+ if !minimized {
+ window.orderFront(nil)
+ }
+
NSApp.activate(ignoringOtherApps: true)
if Bool(opts.fullscreen) {