mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +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:
parent
b89cc81674
commit
60a96b3786
9 changed files with 41 additions and 32 deletions
|
@ -203,7 +203,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
|||
void KeyboardMapperWidget::keydown_event(GUI::KeyEvent& event)
|
||||
{
|
||||
for (int i = 0; i < KEY_COUNT; i++) {
|
||||
if (keys[i].scancode != event.scancode())
|
||||
if (keys[i].kernel_map_entry_index != event.map_entry_index())
|
||||
continue;
|
||||
auto& tmp_button = m_keys.at(i);
|
||||
tmp_button->set_pressed(true);
|
||||
|
@ -221,7 +221,7 @@ void KeyboardMapperWidget::keydown_event(GUI::KeyEvent& event)
|
|||
void KeyboardMapperWidget::keyup_event(GUI::KeyEvent& event)
|
||||
{
|
||||
for (int i = 0; i < KEY_COUNT; i++) {
|
||||
if (keys[i].scancode != event.scancode())
|
||||
if (keys[i].kernel_map_entry_index != event.map_entry_index())
|
||||
continue;
|
||||
auto& tmp_button = m_keys.at(i);
|
||||
tmp_button->set_pressed(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue