mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
Kernel: Fix shift sometimes staying pressed after releasing the key
Previous implementation sometimes didn't release the key after pressing and holding shift due to repeating key updates when holding keys. This meant repeating updates would set/unset `m_both_shift_keys_pressed` repeatedly, sometimes resulting in shift still being considered pressed even after you released it. Simplify left and right shift key pressed logic by tracking both key states separately and always updating modifiers based on them.
This commit is contained in:
parent
57ac8ff1fd
commit
25f76ed771
2 changed files with 7 additions and 7 deletions
|
@ -53,13 +53,12 @@ void PS2KeyboardDevice::irq_handle_byte_read(u8 byte)
|
|||
update_modifier(Mod_Super, pressed);
|
||||
break;
|
||||
case 0x2a:
|
||||
m_left_shift_pressed = pressed;
|
||||
update_modifier(Mod_Shift, m_left_shift_pressed || m_right_shift_pressed);
|
||||
break;
|
||||
case 0x36:
|
||||
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);
|
||||
m_right_shift_pressed = pressed;
|
||||
update_modifier(Mod_Shift, m_left_shift_pressed || m_right_shift_pressed);
|
||||
break;
|
||||
}
|
||||
switch (ch) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue