diff options
author | Liav A <liavalb@gmail.com> | 2023-03-31 18:46:36 +0300 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-03-31 12:45:12 -0400 |
commit | 07b83cf3fa186be24a5752532885d0fcf70bb004 (patch) | |
tree | 8912ec90942cd84f67014b96d950df8926c05073 | |
parent | c3b8b3124c545fec7e8b09f446ee21635d410247 (diff) | |
download | serenity-07b83cf3fa186be24a5752532885d0fcf70bb004.zip |
Kernel/HID: Don't update the remapped Ctrl modifier unconditionally
Instead, only update it when the Caps Lock key event is generated and
remapping to the Ctrl key is enabled.
This fixes a bug that when enabling remapping Caps Lock key to the Ctrl
key, the original Ctrl key is no longer usable.
-rw-r--r-- | Kernel/Devices/HID/KeyboardDevice.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/Devices/HID/KeyboardDevice.cpp b/Kernel/Devices/HID/KeyboardDevice.cpp index b967d2a86d..e71dc7143a 100644 --- a/Kernel/Devices/HID/KeyboardDevice.cpp +++ b/Kernel/Devices/HID/KeyboardDevice.cpp @@ -246,11 +246,10 @@ void KeyboardDevice::key_state_changed(u8 scan_code, bool pressed) if (!g_caps_lock_remapped_to_ctrl && key == Key_CapsLock && pressed) m_caps_lock_on = !m_caps_lock_on; - if (g_caps_lock_remapped_to_ctrl && key == Key_CapsLock) + if (g_caps_lock_remapped_to_ctrl && key == Key_CapsLock) { m_caps_lock_to_ctrl_pressed = pressed; - - if (g_caps_lock_remapped_to_ctrl) update_modifier(Mod_Ctrl, m_caps_lock_to_ctrl_pressed); + } if (pressed) event.flags |= Is_Press; |