From 2cbb13db9edae33d8fe1b078835fd387e69946d3 Mon Sep 17 00:00:00 2001 From: der richter Date: Wed, 3 Apr 2024 20:48:21 +0200 Subject: [PATCH] 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. --- osdep/mac/remote_command_center.swift | 7 +++---- 1 file 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 }