1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

[Android] Set echo property for the physical keyboard events.

This commit is contained in:
bruvzg
2023-07-05 15:34:18 +03:00
parent b7c2fd2e9a
commit c687bfa697
7 changed files with 17 additions and 16 deletions

View File

@@ -147,7 +147,7 @@ public class GodotLib {
/**
* Forward regular key events.
*/
public static native void key(int p_physical_keycode, int p_unicode, int p_key_label, boolean p_pressed);
public static native void key(int p_physical_keycode, int p_unicode, int p_key_label, boolean p_pressed, boolean p_echo);
/**
* Forward game device's key events.

View File

@@ -141,7 +141,7 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
final int physical_keycode = event.getKeyCode();
final int unicode = event.getUnicodeChar();
final int key_label = event.getDisplayLabel();
GodotLib.key(physical_keycode, unicode, key_label, false);
GodotLib.key(physical_keycode, unicode, key_label, false, event.getRepeatCount() > 0);
};
return true;
@@ -176,7 +176,7 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
final int physical_keycode = event.getKeyCode();
final int unicode = event.getUnicodeChar();
final int key_label = event.getDisplayLabel();
GodotLib.key(physical_keycode, unicode, key_label, true);
GodotLib.key(physical_keycode, unicode, key_label, true, event.getRepeatCount() > 0);
}
return true;

View File

@@ -93,8 +93,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
@Override
public void beforeTextChanged(final CharSequence pCharSequence, final int start, final int count, final int after) {
for (int i = 0; i < count; ++i) {
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, 0, true);
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, 0, false);
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, 0, true, false);
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, 0, false, false);
if (mHasSelection) {
mHasSelection = false;
@@ -115,8 +115,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
// Return keys are handled through action events
continue;
}
GodotLib.key(0, character, 0, true);
GodotLib.key(0, character, 0, false);
GodotLib.key(0, character, 0, true, false);
GodotLib.key(0, character, 0, false, false);
}
}
@@ -127,8 +127,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
if (characters != null) {
for (int i = 0; i < characters.length(); i++) {
final int character = characters.codePointAt(i);
GodotLib.key(0, character, 0, true);
GodotLib.key(0, character, 0, false);
GodotLib.key(0, character, 0, true, false);
GodotLib.key(0, character, 0, false, false);
}
}
}
@@ -136,8 +136,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
if (pActionID == EditorInfo.IME_ACTION_DONE) {
// Enter key has been pressed
mRenderView.queueOnRenderThread(() -> {
GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, 0, true);
GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, 0, false);
GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, 0, true, false);
GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, 0, false, false);
});
mRenderView.getView().requestFocus();
return true;