Fix keyboard remapping in password fields and secure input contexts
Changed event handling to create and post new keyboard events instead of modifying existing events, which resolves issues with password fields in web browsers and other secure input contexts that ignore modified events. 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
1 parent
333bbc56f9
commit
99bbbbc73a
1 file changed
+8
-1
@@ -38,7 +38,14 @@ class EventTapManager {
|
||||
if manager.keyMapper.hasMappingFor(keyCode: keyCode) {
|
||||
if let mappedKey = manager.keyMapper.getMappedKey(for: keyCode) {
|
||||
Logger.debug("Remapping: \(keyCode) -> \(mappedKey)")
|
||||
event.setIntegerValueField(.keyboardEventKeycode, value: mappedKey)
|
||||
|
||||
let newEvent = CGEvent(keyboardEventSource: nil, virtualKey: CGKeyCode(mappedKey), keyDown: type == .keyDown)
|
||||
if let newEvent = newEvent {
|
||||
newEvent.flags = event.flags
|
||||
newEvent.post(tap: .cghidEventTap)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user