1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

Kernel/HID: Move code_point assignment before its use key in assignment

We need to handle the character map to set the code point before we can
reassign the correct key to the queued_event.key. This fixes keyboard
shortcuts using the incorrect keys based on the keyboard layout.
This commit is contained in:
John te Bokkel 2024-02-03 09:35:48 -08:00 committed by Andrew Kaster
parent 88af15d513
commit d70424bb0f

View file

@ -43,6 +43,9 @@ void KeyboardDevice::handle_input_event(KeyEvent queued_event)
}
}
if (queued_event.map_entry_index != 0xFF)
queued_event.code_point = HIDManagement::the().get_char_from_character_map(queued_event, queued_event.map_entry_index);
// If using a non-QWERTY layout, queued_event.key needs to be updated to be the same as event.code_point
KeyCode mapped_key = code_point_to_key_code(queued_event.code_point);
if (mapped_key != KeyCode::Key_Invalid)
@ -58,9 +61,6 @@ void KeyboardDevice::handle_input_event(KeyEvent queued_event)
update_modifier(Mod_Ctrl, m_caps_lock_to_ctrl_pressed);
}
if (queued_event.map_entry_index != 0xFF)
queued_event.code_point = HIDManagement::the().get_char_from_character_map(queued_event, queued_event.map_entry_index);
{
SpinlockLocker locker(HIDManagement::the().m_client_lock);
if (HIDManagement::the().m_client)