History

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.

der richter committed 2 years ago

Commit 2cbb13d1 parent 70eba5e1 file · +3 −4Browse files

Unified · Split

osdep/mac/remote_command_center.swift+3−4
@@ -29,7 +29,7 @@ extension RemoteCommandCenter { · 28 unmodified lines
2929 struct Config {
3030 let key: Int32
3131 let type: KeyType
32− var state: UInt32 = 0
32+ var state: NSEvent.EventType = .applicationDefined
3333 let handler: ConfigHandler
3434
3535 init(key: Int32 = 0, type: KeyType = .normal, handler: @escaping ConfigHandler = { event in return .commandFailed }) {
@@ -165,11 +165,10 @@ class RemoteCommandCenter: EventSubscriber { · 129 unmodified lines
165165
166166 var state = config.state
167167 if config.type == .repeatable {
168− state = config.state == MP_KEY_STATE_DOWN ? MP_KEY_STATE_UP : MP_KEY_STATE_DOWN
168+ state = config.state == .keyDown ? .keyUp : .keyDown
169169 self.configs[event.command]?.state = state
170170 }
171−
172− self.input.put(key: config.key | Int32(state))
171+ self.input.put(key: config.key, type: state)
173172
174173 return .success
175174 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t