mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-08 15:47:43 +00:00
move keyboard coordinate transformation to KeyboardActionListener as per ancient TODO
This commit is contained in:
parent
10c0b64e45
commit
df37e3589e
2 changed files with 5 additions and 13 deletions
|
@ -43,8 +43,10 @@ class KeyboardActionListenerImpl(private val latinIME: LatinIME, private val inp
|
|||
keyboardSwitcher.onReleaseKey(primaryCode, withSliding, latinIME.currentAutoCapsState, latinIME.currentRecapitalizeState)
|
||||
}
|
||||
|
||||
override fun onCodeInput(primaryCode: Int, x: Int, y: Int, isKeyRepeat: Boolean) =
|
||||
latinIME.onCodeInput(primaryCode, metaState, x, y, isKeyRepeat)
|
||||
override fun onCodeInput(primaryCode: Int, x: Int, y: Int, isKeyRepeat: Boolean) {
|
||||
val mkv = keyboardSwitcher.mainKeyboardView
|
||||
latinIME.onCodeInput(primaryCode, metaState, mkv.getKeyX(x), mkv.getKeyY(y), isKeyRepeat)
|
||||
}
|
||||
|
||||
override fun onTextInput(text: String?) = latinIME.onTextInput(text)
|
||||
|
||||
|
|
|
@ -1487,22 +1487,12 @@ public class LatinIME extends InputMethodService implements
|
|||
case KeyCode.TOGGLE_INCOGNITO_MODE -> {mSettings.toggleAlwaysIncognitoMode(); return; }
|
||||
}
|
||||
}
|
||||
// TODO: this processing does not belong inside LatinIME, the caller should be doing this.
|
||||
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||
// x and y include some padding, but everything down the line (especially native
|
||||
// code) needs the coordinates in the keyboard frame.
|
||||
// TODO: We should reconsider which coordinate system should be used to represent
|
||||
// keyboard event. Also we should pull this up -- LatinIME has no business doing
|
||||
// this transformation, it should be done already before calling onEvent.
|
||||
final int keyX = mainKeyboardView.getKeyX(x);
|
||||
final int keyY = mainKeyboardView.getKeyY(y);
|
||||
final Event event;
|
||||
|
||||
// checking if the character is a combining accent
|
||||
if (0x300 <= codePoint && codePoint <= 0x35b) {
|
||||
event = Event.createSoftwareDeadEvent(codePoint, 0, metaState, x, y, null);
|
||||
} else {
|
||||
event = createSoftwareKeypressEvent(codePoint, metaState, keyX, keyY, isKeyRepeat);
|
||||
event = createSoftwareKeypressEvent(codePoint, metaState, x, y, isKeyRepeat);
|
||||
}
|
||||
|
||||
onEvent(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue