Skip to content

Commit

Permalink
fix: Do Not Send Key Event for NumPad Key
Browse files Browse the repository at this point in the history
Those keys are already handled in `CommonKeyboardActionListener`, so ignoring those keys here.
Removing the related codes in `CommonKeyboardActionListener` will make `KP_X` keys not working
in normal text field.
  • Loading branch information
goofyz committed Jan 2, 2025
1 parent 43a2c0e commit 46916af
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,13 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
handleReturnKey()
return
}
sendDownKeyEvent(eventTime, keyCode, it.modifiers.metaState)

if (keyCode in KeyEvent.KEYCODE_NUMPAD_0..KeyEvent.KEYCODE_NUMPAD_EQUALS) {
// ignore KP_X keys, which is handled in `CommonKeyboardActionListener`.
// Requires this empty body becoz Kotlin request it
} else {
sendDownKeyEvent(eventTime, keyCode, it.modifiers.metaState)
}
}
} else {
if (!it.modifiers.release && it.unicode > 0) {
Expand Down

0 comments on commit 46916af

Please sign in to comment.