You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Linux/BSD: Modify only keypad keys
The `keycode` field of `InputEventKey` is supposed to be "unshifted"; That is, what the key would output if no modifier keys were pressed. This should match what's written on the key label, but `Key` enumerates also all keypad keys, which require a modifier. We thus require some extra checks for them. Note that this can still allow "stuck keys", but that's an even deeper problem.
This commit is contained in:
@@ -1129,6 +1129,30 @@ void KeyMappingX11::initialize() {
|
||||
location_map[0x86] = KeyLocation::RIGHT;
|
||||
}
|
||||
|
||||
bool KeyMappingX11::is_sym_numpad(KeySym p_keysym) {
|
||||
switch (p_keysym) {
|
||||
case XK_KP_Multiply:
|
||||
case XK_KP_Divide:
|
||||
case XK_KP_Subtract:
|
||||
case XK_KP_Separator:
|
||||
case XK_KP_Add:
|
||||
case XK_KP_0:
|
||||
case XK_KP_1:
|
||||
case XK_KP_2:
|
||||
case XK_KP_3:
|
||||
case XK_KP_4:
|
||||
case XK_KP_5:
|
||||
case XK_KP_6:
|
||||
case XK_KP_7:
|
||||
case XK_KP_8:
|
||||
case XK_KP_9: {
|
||||
return true;
|
||||
} break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Key KeyMappingX11::get_keycode(KeySym p_keysym) {
|
||||
if (p_keysym >= 0x20 && p_keysym < 0x7E) { // ASCII, maps 1-1
|
||||
if (p_keysym > 0x60 && p_keysym < 0x7B) { // Lowercase ASCII.
|
||||
|
||||
Reference in New Issue
Block a user