From 7b6aba428432e95fab5da05b4a65080f1e73a2d7 Mon Sep 17 00:00:00 2001 From: Nufflee Date: Thu, 17 Oct 2019 23:08:10 +0200 Subject: [PATCH] KeyboardDevice: Rename 0xe0 flag for clarity. --- Kernel/Devices/KeyboardDevice.cpp | 13 +++++++------ Kernel/Devices/KeyboardDevice.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Kernel/Devices/KeyboardDevice.cpp b/Kernel/Devices/KeyboardDevice.cpp index 602817bdcfc..37356d7bc99 100644 --- a/Kernel/Devices/KeyboardDevice.cpp +++ b/Kernel/Devices/KeyboardDevice.cpp @@ -247,7 +247,7 @@ void KeyboardDevice::key_state_changed(u8 raw, bool pressed) if (key == Key_NumLock && pressed) m_num_lock_on = !m_num_lock_on; - if (m_num_lock_on && m_is_numpad_key) + if (m_num_lock_on && !m_has_e0_prefix) { if (raw >= 0x47 && raw <= 0x53) { @@ -283,7 +283,7 @@ void KeyboardDevice::key_state_changed(u8 raw, bool pressed) m_client->on_key_pressed(event); m_queue.enqueue(event); - m_is_numpad_key = true; + m_has_e0_prefix = false; } void KeyboardDevice::handle_irq() @@ -296,6 +296,11 @@ void KeyboardDevice::handle_irq() u8 ch = raw & 0x7f; bool pressed = !(raw & 0x80); + if (raw == 0xe0) { + m_has_e0_prefix = true; + return; + } + #ifdef KEYBOARD_DEBUG dbgprintf("Keyboard::handle_irq: %b %s\n", ch, pressed ? "down" : "up"); #endif @@ -313,10 +318,6 @@ void KeyboardDevice::handle_irq() case 0x36: update_modifier(Mod_Shift, pressed); break; - case 0x60: - // This flag means next key pressed could be but is not a numpad key. - m_is_numpad_key = false; - return; } switch (ch) { case I8042_ACK: diff --git a/Kernel/Devices/KeyboardDevice.h b/Kernel/Devices/KeyboardDevice.h index 46cb75558e3..1ac2bcf8418 100644 --- a/Kernel/Devices/KeyboardDevice.h +++ b/Kernel/Devices/KeyboardDevice.h @@ -49,7 +49,7 @@ private: u8 m_modifiers { 0 }; bool m_caps_lock_on { false }; bool m_num_lock_on { false }; - bool m_is_numpad_key { false }; + bool m_has_e0_prefix { false }; }; class KeyboardClient {