From 1dea80d3fd836aa173bf4165d92f0da3511a462b Mon Sep 17 00:00:00 2001 From: der richter Date: Wed, 22 Jan 2020 17:04:33 +0100 Subject: cocoa-cb: add pinch to resize window gesture the event returns a delta ratio so we can just add it to the current window-scale. Adds support for #3214 --- video/out/cocoa-cb/events_view.swift | 5 +++++ video/out/cocoa-cb/window.swift | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/video/out/cocoa-cb/events_view.swift b/video/out/cocoa-cb/events_view.swift index 73ccba527f..124a7a028d 100644 --- a/video/out/cocoa-cb/events_view.swift +++ b/video/out/cocoa-cb/events_view.swift @@ -179,6 +179,11 @@ class EventsView: NSView { } } + override func magnify(with event: NSEvent) { + cocoaCB.layer?.inLiveResize = event.phase == .ended ? false : true + cocoaCB.window?.addWindowScale(Double(event.magnification)) + } + func signalMouseDown(_ event: NSEvent) { signalMouseEvent(event, MP_KEY_STATE_DOWN) if event.clickCount > 1 { diff --git a/video/out/cocoa-cb/window.swift b/video/out/cocoa-cb/window.swift index 03ea17da57..2dbac9751d 100644 --- a/video/out/cocoa-cb/window.swift +++ b/video/out/cocoa-cb/window.swift @@ -461,6 +461,12 @@ class Window: NSWindow, NSWindowDelegate { mpv?.command("set window-scale \(scale)") } + func addWindowScale(_ scale: Double) { + if !isInFullscreen { + mpv?.command("add window-scale \(scale)") + } + } + func windowDidChangeScreen(_ notification: Notification) { if screen == nil { return -- cgit v1.2.3