summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2020-01-22 17:04:33 +0100
committerder richter <der.richter@gmx.de>2020-01-26 12:33:47 +0100
commit1dea80d3fd836aa173bf4165d92f0da3511a462b (patch)
treec4bd81315b7193b4de6f63a2c6a92828a1058645 /video/out
parent2aa4186a258d4d3829c3d072cd69b7c30f0c5eda (diff)
downloadmpv-1dea80d3fd836aa173bf4165d92f0da3511a462b.tar.bz2
mpv-1dea80d3fd836aa173bf4165d92f0da3511a462b.tar.xz
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
Diffstat (limited to 'video/out')
-rw-r--r--video/out/cocoa-cb/events_view.swift5
-rw-r--r--video/out/cocoa-cb/window.swift6
2 files changed, 11 insertions, 0 deletions
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