You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Add physical_scancode (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
This commit is contained in:
@@ -1056,8 +1056,8 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
||||
int keyCode;
|
||||
if ((keyCode = cc[i]) != 0) {
|
||||
// Simulate key down and up...
|
||||
GodotLib.key(0, keyCode, true);
|
||||
GodotLib.key(0, keyCode, false);
|
||||
GodotLib.key(0, 0, keyCode, true);
|
||||
GodotLib.key(0, 0, keyCode, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class GodotLib {
|
||||
/**
|
||||
* Forward regular key events from the main thread to the GL thread.
|
||||
*/
|
||||
public static native void key(int p_scancode, int p_unicode_char, boolean p_pressed);
|
||||
public static native void key(int p_keycode, int p_scancode, int p_unicode_char, boolean p_pressed);
|
||||
|
||||
/**
|
||||
* Forward game device's key events from the main thread to the GL thread.
|
||||
|
||||
@@ -109,11 +109,12 @@ public class GodotInputHandler implements InputDeviceListener {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
final int scanCode = event.getScanCode();
|
||||
final int chr = event.getUnicodeChar(0);
|
||||
queueEvent(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GodotLib.key(keyCode, chr, false);
|
||||
GodotLib.key(keyCode, scanCode, chr, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -154,11 +155,12 @@ public class GodotInputHandler implements InputDeviceListener {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
final int scanCode = event.getScanCode();
|
||||
final int chr = event.getUnicodeChar(0);
|
||||
queueEvent(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GodotLib.key(keyCode, chr, true);
|
||||
GodotLib.key(keyCode, scanCode, chr, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
|
||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
|
||||
GodotLib.key(KeyEvent.KEYCODE_DEL, KeyEvent.KEYCODE_DEL, 0, true);
|
||||
GodotLib.key(KeyEvent.KEYCODE_DEL, KeyEvent.KEYCODE_DEL, 0, false);
|
||||
|
||||
if (mHasSelection) {
|
||||
mHasSelection = false;
|
||||
@@ -127,8 +127,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
// Return keys are handled through action events
|
||||
continue;
|
||||
}
|
||||
GodotLib.key(0, key, true);
|
||||
GodotLib.key(0, key, false);
|
||||
GodotLib.key(0, 0, key, true);
|
||||
GodotLib.key(0, 0, key, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -144,8 +144,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
public void run() {
|
||||
for (int i = 0; i < characters.length(); i++) {
|
||||
final int ch = characters.codePointAt(i);
|
||||
GodotLib.key(0, ch, true);
|
||||
GodotLib.key(0, ch, false);
|
||||
GodotLib.key(0, 0, ch, true);
|
||||
GodotLib.key(0, 0, ch, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -153,8 +153,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
|
||||
if (pActionID == EditorInfo.IME_ACTION_DONE) {
|
||||
// Enter key has been pressed
|
||||
GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, true);
|
||||
GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, false);
|
||||
GodotLib.key(KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_ENTER, 0, true);
|
||||
GodotLib.key(KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_ENTER, 0, false);
|
||||
|
||||
this.mView.requestFocus();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user