summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa-cb/window.swift
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2019-12-01 21:08:54 +0100
committerder richter <der.richter@gmx.de>2019-12-15 20:07:11 +0100
commitf21a980e374b46c978cec0d99145777653f4caca (patch)
tree54ba33824ad58c5a11b20ff6dfcb4753c0dc1340 /video/out/cocoa-cb/window.swift
parentc8cc203735d73f62def2692d1027f45ac10c03db (diff)
downloadmpv-f21a980e374b46c978cec0d99145777653f4caca.tar.bz2
mpv-f21a980e374b46c978cec0d99145777653f4caca.tar.xz
cocoa-cb: update and add more options to use new options handling
this updates and add the maximized, minimized, keepaspect and ontop options to use the new options handling
Diffstat (limited to 'video/out/cocoa-cb/window.swift')
-rw-r--r--video/out/cocoa-cb/window.swift21
1 files changed, 21 insertions, 0 deletions
diff --git a/video/out/cocoa-cb/window.swift b/video/out/cocoa-cb/window.swift
index 48f3210a22..94f80e59b4 100644
--- a/video/out/cocoa-cb/window.swift
+++ b/video/out/cocoa-cb/window.swift
@@ -272,6 +272,22 @@ class Window: NSWindow, NSWindowDelegate {
}
}
+ func setMinimized(_ stateWanted: Bool) {
+ if isMiniaturized == stateWanted { return }
+
+ if stateWanted {
+ performMiniaturize(self)
+ } else {
+ deminiaturize(self)
+ }
+ }
+
+ func setMaximized(_ stateWanted: Bool) {
+ if isZoomed == stateWanted { return }
+
+ zoom(self)
+ }
+
func updateMovableBackground(_ pos: NSPoint) {
if !isInFullscreen {
isMovableByWindowBackground = mpv?.canBeDraggedAt(pos) ?? true
@@ -466,6 +482,7 @@ class Window: NSWindow, NSWindowDelegate {
func windowDidEndLiveResize(_ notification: Notification) {
cocoaCB.layer?.inLiveResize = false
+ cocoaCB.mpv?.setConfigProperty(maximized: isZoomed)
}
func windowShouldClose(_ sender: NSWindow) -> Bool {
@@ -498,4 +515,8 @@ class Window: NSWindow, NSWindowDelegate {
func windowWillMove(_ notification: Notification) {
isMoving = true
}
+
+ func windowDidMove(_ notification: Notification) {
+ cocoaCB.mpv?.setConfigProperty(maximized: isZoomed)
+ }
}