Skip to content

Commit

Permalink
fix: Back, Escape and Enter key action was handled before forward to …
Browse files Browse the repository at this point in the history
…librime

They should be handled by librime first, if librime rejects them, then handle them by system.
  • Loading branch information
WhiredPlanck committed Nov 10, 2024
1 parent 2c9cbfb commit 3f91d3d
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,6 @@ class CommonKeyboardActionListener(
}
KeyEvent.KEYCODE_PROG_RED -> showColorPicker()
KeyEvent.KEYCODE_MENU -> showEnabledSchemaPicker()
KeyEvent.KEYCODE_BACK,
KeyEvent.KEYCODE_ESCAPE,
-> service.requestHideSelf(0)
KeyEvent.KEYCODE_ENTER -> service.handleReturnKey()
else -> {
if (event.mask == 0 && KeyboardSwitcher.currentKeyboard.isOnlyShiftOn) {
if (event.code == KeyEvent.KEYCODE_SPACE && prefs.keyboard.hookShiftSpace) {
Expand Down Expand Up @@ -264,10 +260,15 @@ class CommonKeyboardActionListener(

shouldReleaseKey = false

// 小键盘自动增加锁定
if (keyEventCode >= KeyEvent.KEYCODE_NUMPAD_0 && keyEventCode <= KeyEvent.KEYCODE_NUMPAD_EQUALS) {
service.sendDownUpKeyEvent(keyEventCode, metaState or KeyEvent.META_NUM_LOCK_ON)
return
when (keyEventCode) {
KeyEvent.KEYCODE_ENTER -> service.handleReturnKey()
KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_ESCAPE -> service.requestHideSelf(0)
else -> {
// 小键盘自动增加锁定
if (keyEventCode in KeyEvent.KEYCODE_NUMPAD_0..KeyEvent.KEYCODE_NUMPAD_EQUALS) {
service.sendDownUpKeyEvent(keyEventCode, metaState or KeyEvent.META_NUM_LOCK_ON)
}
}
}
}

Expand Down

0 comments on commit 3f91d3d

Please sign in to comment.