1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:18:14 +00:00

Userland: Actually use the correct character map index from KeyEvent

Instead of using a scan code, which for scan code set 2 will not
represent the expected character mapping index, we could just use
another variable in the KeyEvent structure that correctly points to the
character index.

This change is mostly relevant to the KeyboardMapper application, and
also to the WindowServer code, as both handle KeyEvents and need to
use the character mapping index in various situations.
This commit is contained in:
Liav A 2023-04-14 18:57:41 +03:00 committed by Andrew Kaster
parent b89cc81674
commit 60a96b3786
9 changed files with 41 additions and 32 deletions

View file

@ -459,7 +459,7 @@ void ScreenInput::on_receive_mouse_data(MousePacket const& packet)
void ScreenInput::on_receive_keyboard_data(::KeyEvent kernel_event)
{
m_modifiers = kernel_event.modifiers();
auto message = make<KeyEvent>(kernel_event.is_press() ? Event::KeyDown : Event::KeyUp, kernel_event.key, kernel_event.code_point, kernel_event.modifiers(), kernel_event.scancode);
auto message = make<KeyEvent>(kernel_event.is_press() ? Event::KeyDown : Event::KeyUp, kernel_event.key, kernel_event.map_entry_index, kernel_event.code_point, kernel_event.modifiers(), kernel_event.scancode);
Core::EventLoop::current().post_event(WindowManager::the(), move(message));
}