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

Allow for mapping keycodes to current layout

This commit is contained in:
Frixuu
2021-09-17 03:07:59 +02:00
parent 2d1699ef82
commit 650e63a7ca
13 changed files with 250 additions and 135 deletions

View File

@@ -309,6 +309,18 @@ unsigned int KeyMappingX11::get_scancode(unsigned int p_code) {
return keycode;
}
unsigned int KeyMappingX11::get_xlibcode(unsigned int p_keysym) {
unsigned int code = 0;
for (int i = 0; _scancode_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
if (_scancode_to_keycode[i].keysym == p_keysym) {
code = _scancode_to_keycode[i].keycode;
break;
}
}
return code;
}
Key KeyMappingX11::get_keycode(KeySym p_keysym) {
// kinda bruteforce.. could optimize.