diff options
author | der richter <der.richter@gmx.de> | 2019-11-30 16:08:32 +0100 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2019-12-15 20:07:31 +0100 |
commit | a32db637b5c66c0304147caadf02d7b28083bcee (patch) | |
tree | a078fd47fd36cc853a1422ea05a949fbc9afde60 /video/out | |
parent | 8a6ee7fe947bb01a49beb38152cedb1e1b206ed2 (diff) | |
download | mpv-a32db637b5c66c0304147caadf02d7b28083bcee.tar.bz2 mpv-a32db637b5c66c0304147caadf02d7b28083bcee.tar.xz |
mac: replace old event tap for media key support with MediaPlayer
the old event tap has several problems, like no proper priority support
or having to set accessibility permissions for mpv or the terminal.
it is now replaced by the new MediaPlayer which has proper priority
support and isn't as greedy as previously. this only includes Media Key
support and not any of the other features included in the MediaPlayer
framework, like proper Now Playing data (only set dummy data for now).
this is only available on macOS 10.12.2 and higher.
also removes some unnecessary redefines.
Fixes #6389
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/cocoa-cb/events_view.swift | 12 | ||||
-rw-r--r-- | video/out/cocoa-cb/window.swift | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/video/out/cocoa-cb/events_view.swift b/video/out/cocoa-cb/events_view.swift index 31533bbb98..73ccba527f 100644 --- a/video/out/cocoa-cb/events_view.swift +++ b/video/out/cocoa-cb/events_view.swift @@ -180,20 +180,20 @@ class EventsView: NSView { } func signalMouseDown(_ event: NSEvent) { - signalMouseEvent(event, SWIFT_KEY_STATE_DOWN) + signalMouseEvent(event, MP_KEY_STATE_DOWN) if event.clickCount > 1 { - signalMouseEvent(event, SWIFT_KEY_STATE_UP) + signalMouseEvent(event, MP_KEY_STATE_UP) } } func signalMouseUp(_ event: NSEvent) { - signalMouseEvent(event, SWIFT_KEY_STATE_UP) + signalMouseEvent(event, MP_KEY_STATE_UP) } - func signalMouseEvent(_ event: NSEvent, _ state: Int32) { - hasMouseDown = state == SWIFT_KEY_STATE_DOWN + func signalMouseEvent(_ event: NSEvent, _ state: UInt32) { + hasMouseDown = state == MP_KEY_STATE_DOWN let mpkey = getMpvButton(event) - cocoa_put_key_with_modifiers((mpkey | state), Int32(event.modifierFlags.rawValue)); + cocoa_put_key_with_modifiers((mpkey | Int32(state)), Int32(event.modifierFlags.rawValue)); } func signalMouseMovement(_ event: NSEvent) { diff --git a/video/out/cocoa-cb/window.swift b/video/out/cocoa-cb/window.swift index 94f80e59b4..6e53ef309c 100644 --- a/video/out/cocoa-cb/window.swift +++ b/video/out/cocoa-cb/window.swift @@ -486,7 +486,7 @@ class Window: NSWindow, NSWindowDelegate { } func windowShouldClose(_ sender: NSWindow) -> Bool { - cocoa_put_key(SWIFT_KEY_CLOSE_WIN) + cocoa_put_key(MP_KEY_CLOSE_WIN) return false } |