mac: add support for --input-cursor-passthrough option

This commit is contained in:
der richter 2023-12-24 16:00:35 +01:00
parent dde2776655
commit 4d7763e6a6
3 changed files with 6 additions and 1 deletions

View File

@ -4149,7 +4149,7 @@ Input
Support depends on the VO in use. Support depends on the VO in use.
``--input-cursor-passthrough``, ``--no-input-cursor-passthrough`` ``--input-cursor-passthrough``, ``--no-input-cursor-passthrough``
(X11 and Wayland only) (X11, Wayland and macOS only)
Tell the backend windowing system to allow pointer events to passthrough Tell the backend windowing system to allow pointer events to passthrough
the mpv window. This allows windows under mpv to instead receive pointer the mpv window. This allows windows under mpv to instead receive pointer
events as if the mpv window was never there. events as if the mpv window was never there.

View File

@ -553,6 +553,10 @@ class Common: NSObject {
DispatchQueue.main.async { DispatchQueue.main.async {
self.window?.setMaximized(Bool(mpv.opts.window_maximized)) self.window?.setMaximized(Bool(mpv.opts.window_maximized))
} }
case MPVHelper.getPointer(&mpv.optsPtr.pointee.cursor_passthrough):
DispatchQueue.main.async {
self.window?.ignoresMouseEvents = mpv.opts.cursor_passthrough
}
case MPVHelper.getPointer(&mpv.optsPtr.pointee.geometry): fallthrough case MPVHelper.getPointer(&mpv.optsPtr.pointee.geometry): fallthrough
case MPVHelper.getPointer(&mpv.optsPtr.pointee.autofit): fallthrough case MPVHelper.getPointer(&mpv.optsPtr.pointee.autofit): fallthrough
case MPVHelper.getPointer(&mpv.optsPtr.pointee.autofit_smaller): fallthrough case MPVHelper.getPointer(&mpv.optsPtr.pointee.autofit_smaller): fallthrough

View File

@ -91,6 +91,7 @@ class Window: NSWindow, NSWindowDelegate {
title = com.title title = com.title
minSize = NSMakeSize(160, 90) minSize = NSMakeSize(160, 90)
collectionBehavior = .fullScreenPrimary collectionBehavior = .fullScreenPrimary
ignoresMouseEvents = mpv?.opts.cursor_passthrough ?? false
delegate = self delegate = self
if let cView = contentView { if let cView = contentView {