Merge pull request #99633 from buresu/fix-wayland-keymapping

Fix underscore input not working with jp106 keyboard on wayland platform
This commit is contained in:
Thaddeus Crews 2024-12-10 14:15:51 -06:00
commit f222cc43f3
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84

View file

@ -197,10 +197,7 @@ bool WaylandThread::_seat_state_configure_key_event(SeatState &p_ss, Ref<InputEv
Key keycode = KeyMappingXKB::get_keycode(xkb_state_key_get_one_sym(p_ss.xkb_state, p_keycode));
Key physical_keycode = KeyMappingXKB::get_scancode(p_keycode);
KeyLocation key_location = KeyMappingXKB::get_location(p_keycode);
if (physical_keycode == Key::NONE) {
return false;
}
uint32_t unicode = xkb_state_key_get_utf32(p_ss.xkb_state, p_keycode);
if (keycode == Key::NONE) {
keycode = physical_keycode;
@ -210,6 +207,10 @@ bool WaylandThread::_seat_state_configure_key_event(SeatState &p_ss, Ref<InputEv
keycode -= 'a' - 'A';
}
if (physical_keycode == Key::NONE && keycode == Key::NONE && unicode == 0) {
return false;
}
p_event->set_window_id(DisplayServer::MAIN_WINDOW_ID);
// Set all pressed modifiers.
@ -223,8 +224,6 @@ bool WaylandThread::_seat_state_configure_key_event(SeatState &p_ss, Ref<InputEv
p_event->set_physical_keycode(physical_keycode);
p_event->set_location(key_location);
uint32_t unicode = xkb_state_key_get_utf32(p_ss.xkb_state, p_keycode);
if (unicode != 0) {
p_event->set_key_label(fix_key_label(unicode, keycode));
} else {