[Android] Set `echo` property for the physical keyboard events.
(cherry picked from commit c687bfa697
)
This commit is contained in:
parent
b47d786921
commit
f346b8133e
|
@ -64,7 +64,7 @@ void AndroidInputHandler::_set_key_modifier_state(Ref<InputEventWithModifiers> e
|
|||
}
|
||||
}
|
||||
|
||||
void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed) {
|
||||
void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed, bool p_echo) {
|
||||
static char32_t prev_wc = 0;
|
||||
char32_t unicode = p_unicode;
|
||||
if ((p_unicode & 0xfffffc00) == 0xd800) {
|
||||
|
@ -125,6 +125,7 @@ void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicod
|
|||
ev->set_key_label(fix_key_label(p_key_label, keycode));
|
||||
ev->set_unicode(fix_unicode(unicode));
|
||||
ev->set_pressed(p_pressed);
|
||||
ev->set_echo(p_echo);
|
||||
|
||||
_set_key_modifier_state(ev, keycode);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
void process_magnify(Point2 p_pos, float p_factor);
|
||||
void process_pan(Point2 p_pos, Vector2 p_delta);
|
||||
void process_joy_event(JoypadEvent p_event);
|
||||
void process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed);
|
||||
void process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed, bool p_echo);
|
||||
};
|
||||
|
||||
#endif // ANDROID_INPUT_HANDLER_H
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -385,11 +385,11 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(
|
|||
}
|
||||
|
||||
// Called on the UI thread
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed) {
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed, jboolean p_echo) {
|
||||
if (step.get() <= 0) {
|
||||
return;
|
||||
}
|
||||
input_handler->process_key_event(p_physical_keycode, p_unicode, p_key_label, p_pressed);
|
||||
input_handler->process_key_event(p_physical_keycode, p_unicode, p_key_label, p_pressed, p_echo);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) {
|
||||
|
|
|
@ -49,7 +49,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchMouseEvent(JN
|
|||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchTouchEvent(JNIEnv *env, jclass clazz, jint ev, jint pointer, jint pointer_count, jfloatArray positions, jboolean p_double_tap);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnify(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_factor);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_pan(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed, jboolean p_echo);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jclass clazz, jint p_device, jint p_button, jboolean p_pressed);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value);
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y);
|
||||
|
|
Loading…
Reference in New Issue