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)
|
keyboardSwitcher.onReleaseKey(primaryCode, withSliding, latinIME.currentAutoCapsState, latinIME.currentRecapitalizeState)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCodeInput(primaryCode: Int, x: Int, y: Int, isKeyRepeat: Boolean) =
|
override fun onCodeInput(primaryCode: Int, x: Int, y: Int, isKeyRepeat: Boolean) {
|
||||||
latinIME.onCodeInput(primaryCode, metaState, x, y, isKeyRepeat)
|
val mkv = keyboardSwitcher.mainKeyboardView
|
||||||
|
latinIME.onCodeInput(primaryCode, metaState, mkv.getKeyX(x), mkv.getKeyY(y), isKeyRepeat)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onTextInput(text: String?) = latinIME.onTextInput(text)
|
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; }
|
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;
|
final Event event;
|
||||||
|
|
||||||
// checking if the character is a combining accent
|
// checking if the character is a combining accent
|
||||||
if (0x300 <= codePoint && codePoint <= 0x35b) {
|
if (0x300 <= codePoint && codePoint <= 0x35b) {
|
||||||
event = Event.createSoftwareDeadEvent(codePoint, 0, metaState, x, y, null);
|
event = Event.createSoftwareDeadEvent(codePoint, 0, metaState, x, y, null);
|
||||||
} else {
|
} else {
|
||||||
event = createSoftwareKeypressEvent(codePoint, metaState, keyX, keyY, isKeyRepeat);
|
event = createSoftwareKeypressEvent(codePoint, metaState, x, y, isKeyRepeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
onEvent(event);
|
onEvent(event);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue