mirror of
https://github.com/godotengine/godot.git
synced 2025-01-23 11:03:13 -05:00
fix enter key
This commit is contained in:
parent
51429bd8d6
commit
14bbdcb139
2 changed files with 10 additions and 8 deletions
|
@ -65,8 +65,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||||
final String insertText = s.subSequence(this.mText.length(), s.length()).toString();
|
final String insertText = s.subSequence(this.mText.length(), s.length()).toString();
|
||||||
for(int i = 0; i < insertText.length(); i++) {
|
for(int i = 0; i < insertText.length(); i++) {
|
||||||
int ch = insertText.codePointAt(i);
|
int ch = insertText.codePointAt(i);
|
||||||
GodotLib.key(0, ch, false);
|
|
||||||
GodotLib.key(0, ch, true);
|
GodotLib.key(0, ch, true);
|
||||||
|
GodotLib.key(0, ch, false);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
|
@ -75,8 +75,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
for (; nModified < 0; ++nModified) {
|
for (; nModified < 0; ++nModified) {
|
||||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
|
|
||||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
|
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
|
||||||
|
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
|
||||||
/*
|
/*
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Log.d(TAG, "deleteBackward");
|
Log.d(TAG, "deleteBackward");
|
||||||
|
@ -107,8 +107,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||||
if (this.mEdit == pTextView && this.isFullScreenEdit()) {
|
if (this.mEdit == pTextView && this.isFullScreenEdit()) {
|
||||||
// user press the action button, delete all old text and insert new text
|
// user press the action button, delete all old text and insert new text
|
||||||
for (int i = this.mOriginText.length(); i > 0; i--) {
|
for (int i = this.mOriginText.length(); i > 0; i--) {
|
||||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
|
|
||||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
|
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
|
||||||
|
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
|
||||||
/*
|
/*
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Log.d(TAG, "deleteBackward");
|
Log.d(TAG, "deleteBackward");
|
||||||
|
@ -128,8 +128,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||||
|
|
||||||
for(int i = 0; i < text.length(); i++) {
|
for(int i = 0; i < text.length(); i++) {
|
||||||
int ch = text.codePointAt(i);
|
int ch = text.codePointAt(i);
|
||||||
GodotLib.key(0, ch, false);
|
|
||||||
GodotLib.key(0, ch, true);
|
GodotLib.key(0, ch, true);
|
||||||
|
GodotLib.key(0, ch, false);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
|
|
|
@ -1199,14 +1199,16 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject
|
||||||
ievent.key.mod.control=false;
|
ievent.key.mod.control=false;
|
||||||
ievent.key.echo=false;
|
ievent.key.echo=false;
|
||||||
|
|
||||||
if (val == 61448) {
|
if (val == '\n')
|
||||||
|
{
|
||||||
|
ievent.key.scancode = KEY_ENTER;
|
||||||
|
}else if (val == 61448) {
|
||||||
ievent.key.scancode = KEY_BACKSPACE;
|
ievent.key.scancode = KEY_BACKSPACE;
|
||||||
ievent.key.unicode = KEY_BACKSPACE;
|
ievent.key.unicode = KEY_BACKSPACE;
|
||||||
};
|
} else if (val == 61453) {
|
||||||
if (val == 61453) {
|
|
||||||
ievent.key.scancode = KEY_ENTER;
|
ievent.key.scancode = KEY_ENTER;
|
||||||
ievent.key.unicode = KEY_ENTER;
|
ievent.key.unicode = KEY_ENTER;
|
||||||
};
|
}
|
||||||
|
|
||||||
input_mutex->lock();
|
input_mutex->lock();
|
||||||
key_events.push_back(ievent);
|
key_events.push_back(ievent);
|
||||||
|
|
Loading…
Add table
Reference in a new issue