diff options
author | 2014-03-12 16:08:21 +0900 | |
---|---|---|
committer | 2014-03-13 17:47:13 +0900 | |
commit | 92db209c60f82dee19e2c684ef58093817bf8bba (patch) | |
tree | 90f1b82fd5d484948d7be432e1934c380a880d71 /java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java | |
parent | 5dc17c22ca88cf1dcf2225d8b252bcfa8c84d364 (diff) | |
download | latinime-92db209c60f82dee19e2c684ef58093817bf8bba.tar.gz latinime-92db209c60f82dee19e2c684ef58093817bf8bba.tar.xz latinime-92db209c60f82dee19e2c684ef58093817bf8bba.zip |
[CB01] Reset some old assumptions about dead keys
The combining framework will be more generic than previously
thought. We don't need to handle dead keys as a special type
of event, as all events can be combined arbitrarily.
Bug: 13406701
Change-Id: I8137fdb186c4d70eaa71808c5a1430b1559db1ae
Diffstat (limited to 'java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java')
-rw-r--r-- | java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java b/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java index 720d07433..635f3b123 100644 --- a/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java +++ b/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java @@ -47,27 +47,33 @@ public class HardwareKeyboardEventDecoder implements HardwareEventDecoder { // the key for 'A' or Space, but also Backspace or Ctrl or Caps Lock. final int keyCode = keyEvent.getKeyCode(); if (KeyEvent.KEYCODE_DEL == keyCode) { - return Event.createCommittableEvent(Constants.CODE_DELETE, null /* next */); + return Event.createInputKeypressEvent(Event.NOT_A_CODE_POINT, Constants.CODE_DELETE, + null /* next */); } if (keyEvent.isPrintingKey() || KeyEvent.KEYCODE_SPACE == keyCode || KeyEvent.KEYCODE_ENTER == keyCode) { if (0 != (codePointAndFlags & KeyCharacterMap.COMBINING_ACCENT)) { // A dead key. return Event.createDeadEvent( - codePointAndFlags & KeyCharacterMap.COMBINING_ACCENT_MASK, null /* next */); + codePointAndFlags & KeyCharacterMap.COMBINING_ACCENT_MASK, keyCode, + null /* next */); } if (KeyEvent.KEYCODE_ENTER == keyCode) { // The Enter key. If the Shift key is not being pressed, this should send a // CODE_ENTER to trigger the action if any, or a carriage return otherwise. If the // Shift key is being pressed, this should send a CODE_SHIFT_ENTER and let // Latin IME decide what to do with it. - return Event.createCommittableEvent(keyEvent.isShiftPressed() - ? Constants.CODE_SHIFT_ENTER : Constants.CODE_ENTER, - null /* next */); + if (keyEvent.isShiftPressed()) { + return Event.createInputKeypressEvent(Event.NOT_A_CODE_POINT, + Constants.CODE_SHIFT_ENTER, null /* next */); + } else { + return Event.createInputKeypressEvent(Constants.CODE_ENTER, keyCode, + null /* next */); + } } - // If not Enter, then we have a committable character. This should be committed - // right away, taking into account the current state. - return Event.createCommittableEvent(codePointAndFlags, null /* next */); + // If not Enter, then this is just a regular keypress event for a normal character + // that can be committed right away, taking into account the current state. + return Event.createInputKeypressEvent(keyCode, codePointAndFlags, null /* next */); } return Event.createNotHandledEvent(); } |