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

Kernel: Handle both shift keys being pressed and then released

Our current implementation does not work in the special case in which
both shift keys are pressed, and then only one of the keys is released,
as this would result in writing lower case letters, instead of the
expected upper case letters.

This commit fixes that by keeping track of the amount of shift keys
that are pressed (instead of if any are at all), and only switching to
the unshifted keymap once all of them are released.
This commit is contained in:
Idan Horowitz 2021-05-01 20:10:06 +03:00 committed by Andreas Kling
parent 63ff271125
commit 8293b22361
2 changed files with 7 additions and 1 deletions

View file

@ -54,7 +54,12 @@ void PS2KeyboardDevice::irq_handle_byte_read(u8 byte)
break;
case 0x2a:
case 0x36:
update_modifier(Mod_Shift, pressed);
if (m_both_shift_keys_pressed)
m_both_shift_keys_pressed = false;
else if ((m_modifiers & Mod_Shift) != 0 && pressed)
m_both_shift_keys_pressed = true;
else
update_modifier(Mod_Shift, pressed);
break;
}
switch (ch) {