You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Wayland: Unstuck keys with same keycode
This fixes once and for all the core issue of different Godot `keycode`s
released from the same raw XKB keycode.
The `InputEventKey` `keycode` value _should_ map to the "unmodified"
key, but unfortunately there's an ambiguity with their encoding for
"special" keys ("delete", "insert", etc.), in witch they ignore their
unicode representation. This means that a key that is special when plain
but a character when modified would never be properly picked up, so we
do indeed change its keycode. As a consequence of this exception, some
Godot keys never receive release events and get "stuck".
This patch adds an extra check through an `HashMap` to "unstuck" keys
that changed while having the same keycode.
I also could not resist simplifying a bit the regular key event
generation method but this makes things more consistent and predictable
IMO.
This commit is contained in:
@@ -369,33 +369,6 @@ void KeyMappingXKB::initialize() {
|
||||
location_map[0x86] = KeyLocation::RIGHT;
|
||||
}
|
||||
|
||||
bool KeyMappingXKB::is_sym_numpad(xkb_keysym_t p_keysym) {
|
||||
switch (p_keysym) {
|
||||
case XKB_KEY_KP_Equal:
|
||||
case XKB_KEY_KP_Add:
|
||||
case XKB_KEY_KP_Subtract:
|
||||
case XKB_KEY_KP_Multiply:
|
||||
case XKB_KEY_KP_Divide:
|
||||
case XKB_KEY_KP_Separator:
|
||||
case XKB_KEY_KP_Decimal:
|
||||
case XKB_KEY_KP_Delete:
|
||||
case XKB_KEY_KP_0:
|
||||
case XKB_KEY_KP_1:
|
||||
case XKB_KEY_KP_2:
|
||||
case XKB_KEY_KP_3:
|
||||
case XKB_KEY_KP_4:
|
||||
case XKB_KEY_KP_5:
|
||||
case XKB_KEY_KP_6:
|
||||
case XKB_KEY_KP_7:
|
||||
case XKB_KEY_KP_8:
|
||||
case XKB_KEY_KP_9: {
|
||||
return true;
|
||||
} break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Key KeyMappingXKB::get_keycode(xkb_keycode_t 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