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.
This commit is contained in:
der richter 2020-03-06 17:31:23 +01:00
parent c784820454
commit cd22e93fee
1 changed files with 9 additions and 1 deletions

View File

@ -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) {