mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-08 07:37:41 +00:00
add basic support for modifier keys, fixes #479
This commit is contained in:
parent
1a91ce5dd0
commit
71727de5a0
16 changed files with 158 additions and 72 deletions
|
@ -1075,6 +1075,7 @@ public class LatinIME extends InputMethodService implements
|
|||
mHandler.cancelUpdateSuggestionStrip();
|
||||
// Should do the following in onFinishInputInternal but until JB MR2 it's not called :(
|
||||
mInputLogic.finishInput();
|
||||
mKeyboardActionListener.resetMetaState();
|
||||
}
|
||||
|
||||
protected void deallocateMemory() {
|
||||
|
@ -1453,9 +1454,13 @@ public class LatinIME extends InputMethodService implements
|
|||
}
|
||||
}
|
||||
|
||||
// Implementation of {@link KeyboardActionListener}.
|
||||
// Implementation of {@link SuggestionStripView.Listener}.
|
||||
@Override
|
||||
public void onCodeInput(final int codePoint, final int x, final int y, final boolean isKeyRepeat) {
|
||||
onCodeInput(codePoint, 0, x, y, isKeyRepeat);
|
||||
}
|
||||
|
||||
public void onCodeInput(final int codePoint, final int metaState, final int x, final int y, final boolean isKeyRepeat) {
|
||||
if (codePoint < 0) {
|
||||
switch (codePoint) {
|
||||
case KeyCode.TOGGLE_AUTOCORRECT -> {mSettings.toggleAutoCorrect(); return; }
|
||||
|
@ -1471,7 +1476,7 @@ public class LatinIME extends InputMethodService implements
|
|||
// 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 = createSoftwareKeypressEvent(codePoint, keyX, keyY, isKeyRepeat);
|
||||
final Event event = createSoftwareKeypressEvent(codePoint, metaState, keyX, keyY, isKeyRepeat);
|
||||
onEvent(event);
|
||||
}
|
||||
|
||||
|
@ -1493,8 +1498,8 @@ public class LatinIME extends InputMethodService implements
|
|||
// squashed into the same variable, and this method should be removed.
|
||||
// public for testing, as we don't want to copy the same logic into test code
|
||||
@NonNull
|
||||
public static Event createSoftwareKeypressEvent(final int keyCodeOrCodePoint, final int keyX,
|
||||
final int keyY, final boolean isKeyRepeat) {
|
||||
public static Event createSoftwareKeypressEvent(final int keyCodeOrCodePoint, final int metaState,
|
||||
final int keyX, final int keyY, final boolean isKeyRepeat) {
|
||||
final int keyCode;
|
||||
final int codePoint;
|
||||
if (keyCodeOrCodePoint <= 0) {
|
||||
|
@ -1504,7 +1509,7 @@ public class LatinIME extends InputMethodService implements
|
|||
keyCode = Event.NOT_A_KEY_CODE;
|
||||
codePoint = keyCodeOrCodePoint;
|
||||
}
|
||||
return Event.createSoftwareKeypressEvent(codePoint, keyCode, keyX, keyY, isKeyRepeat);
|
||||
return Event.createSoftwareKeypressEvent(codePoint, keyCode, metaState, keyX, keyY, isKeyRepeat);
|
||||
}
|
||||
|
||||
public void onTextInput(final String rawText) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue