Skip to content

Commit 46916af

Browse files
committed
fix: Do Not Send Key Event for NumPad Key
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.
1 parent 43a2c0e commit 46916af

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/src/main/java/com/osfans/trime/ime/core/TrimeInputMethodService.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,13 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
243243
handleReturnKey()
244244
return
245245
}
246-
sendDownKeyEvent(eventTime, keyCode, it.modifiers.metaState)
246+
247+
if (keyCode in KeyEvent.KEYCODE_NUMPAD_0..KeyEvent.KEYCODE_NUMPAD_EQUALS) {
248+
// ignore KP_X keys, which is handled in `CommonKeyboardActionListener`.
249+
// Requires this empty body becoz Kotlin request it
250+
} else {
251+
sendDownKeyEvent(eventTime, keyCode, it.modifiers.metaState)
252+
}
247253
}
248254
} else {
249255
if (!it.modifiers.release && it.unicode > 0) {

0 commit comments

Comments
 (0)