diff options
author | der richter <der.richter@gmx.de> | 2024-04-03 20:48:21 +0200 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2024-04-04 19:39:27 +0200 |
commit | 2cbb13db9edae33d8fe1b078835fd387e69946d3 (patch) | |
tree | a9b66f9acd22ce439a724a00039012bd0c21af6f /osdep | |
parent | 70eba5e83191d82660dda1ac327057d4504d0b15 (diff) | |
download | mpv-2cbb13db9edae33d8fe1b078835fd387e69946d3.tar.bz2 mpv-2cbb13db9edae33d8fe1b078835fd387e69946d3.tar.xz |
mac/remote: use event type as key state for proper mapping in function
instead of using the MP_KEY events (Int32) and using a logical OR to
generate a key event for the mpv core, use the cocoa event type for key
states and pass those to the the function. in the function we properly
map those events to the right MP_KEY events.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/mac/remote_command_center.swift | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/osdep/mac/remote_command_center.swift b/osdep/mac/remote_command_center.swift index 358a0a00dd..0e0eaeb439 100644 --- a/osdep/mac/remote_command_center.swift +++ b/osdep/mac/remote_command_center.swift @@ -29,7 +29,7 @@ extension RemoteCommandCenter { struct Config { let key: Int32 let type: KeyType - var state: UInt32 = 0 + var state: NSEvent.EventType = .applicationDefined let handler: ConfigHandler init(key: Int32 = 0, type: KeyType = .normal, handler: @escaping ConfigHandler = { event in return .commandFailed }) { @@ -165,11 +165,10 @@ class RemoteCommandCenter: EventSubscriber { var state = config.state if config.type == .repeatable { - state = config.state == MP_KEY_STATE_DOWN ? MP_KEY_STATE_UP : MP_KEY_STATE_DOWN + state = config.state == .keyDown ? .keyUp : .keyDown self.configs[event.command]?.state = state } - - self.input.put(key: config.key | Int32(state)) + self.input.put(key: config.key, type: state) return .success } |