From aa974b2aa7b99ec94f66272a7ddd4bfc62438a2f Mon Sep 17 00:00:00 2001 From: Akemi Date: Wed, 28 Feb 2018 00:46:16 +0100 Subject: cocoa-cb: make fullscreen resize animation duration configurable --- video/out/cocoa-cb/window.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/cocoa-cb/window.swift b/video/out/cocoa-cb/window.swift index f720205e5c..c2a6feea9d 100644 --- a/video/out/cocoa-cb/window.swift +++ b/video/out/cocoa-cb/window.swift @@ -252,7 +252,7 @@ class Window: NSWindow, NSWindowDelegate { hideTitleBar() NSAnimationContext.runAnimationGroup({ (context) -> Void in - context.duration = duration - 0.05 + context.duration = getFsAnimationDuration(duration - 0.05) window.animator().setFrame(intermediateFrame, display: true) }, completionHandler: { }) } @@ -264,7 +264,7 @@ class Window: NSWindow, NSWindowDelegate { setFrame(intermediateFrame, display: true) NSAnimationContext.runAnimationGroup({ (context) -> Void in - context.duration = duration - 0.05 + context.duration = getFsAnimationDuration(duration - 0.05) window.animator().setFrame(newFrame, display: true) }, completionHandler: { }) } @@ -328,6 +328,15 @@ class Window: NSWindow, NSWindowDelegate { cocoaCB.layer.neededFlips += 1 } + func getFsAnimationDuration(_ def: Double) -> Double{ + let duration = mpv.getStringProperty("macos-fs-animation-duration") ?? "default" + if duration == "default" { + return def + } else { + return Double(duration)!/1000 + } + } + func setOnTop(_ state: Bool) { if state { let ontopLevel = mpv.getStringProperty("ontop-level") ?? "window" -- cgit v1.2.3