mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
Kernel: Add a key code modifier to detect the number pad
This is analagous to how Qt exposes whether the number pad was used for a key press.
This commit is contained in:
parent
4c81d39483
commit
f798e43ea8
Notes:
sideshowbarker
2024-07-16 19:57:55 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/f798e43ea8 Pull-request: https://github.com/SerenityOS/serenity/pull/19892
2 changed files with 21 additions and 1 deletions
|
@ -134,7 +134,8 @@ enum KeyModifier {
|
|||
Mod_Shift = (1 << 2),
|
||||
Mod_Super = (1 << 3),
|
||||
Mod_AltGr = (1 << 4),
|
||||
Mod_Mask = Mod_Alt | Mod_Ctrl | Mod_Shift | Mod_Super | Mod_AltGr,
|
||||
Mod_Keypad = (1 << 5),
|
||||
Mod_Mask = Mod_Alt | Mod_Ctrl | Mod_Shift | Mod_Super | Mod_AltGr | Mod_Keypad,
|
||||
|
||||
Is_Press = 0x80,
|
||||
};
|
||||
|
@ -151,6 +152,7 @@ struct KeyEvent {
|
|||
bool shift() const { return flags & Mod_Shift; }
|
||||
bool super() const { return flags & Mod_Super; }
|
||||
bool altgr() const { return flags & Mod_AltGr; }
|
||||
bool keypad() const { return flags & Mod_Keypad; }
|
||||
unsigned modifiers() const { return flags & Mod_Mask; }
|
||||
bool is_press() const { return flags & Is_Press; }
|
||||
};
|
||||
|
|
|
@ -243,6 +243,24 @@ void KeyboardDevice::handle_scan_code_input_event(ScanCodeEvent event)
|
|||
m_right_shift_pressed = event.pressed;
|
||||
update_modifier(Mod_Shift, m_left_shift_pressed || m_right_shift_pressed);
|
||||
break;
|
||||
case 0x35:
|
||||
case 0x37:
|
||||
case 0x47:
|
||||
case 0x48:
|
||||
case 0x49:
|
||||
case 0x4a:
|
||||
case 0x4b:
|
||||
case 0x4c:
|
||||
case 0x4d:
|
||||
case 0x4e:
|
||||
case 0x4f:
|
||||
case 0x50:
|
||||
case 0x51:
|
||||
case 0x52:
|
||||
case 0x53:
|
||||
// FIXME: This should also include the keypad "enter" key, but that has the same scan code as the return key (0x1c).
|
||||
update_modifier(Mod_Keypad, event.pressed);
|
||||
break;
|
||||
}
|
||||
|
||||
KeyCode key = (m_modifiers & Mod_Shift) ? shifted_key_map[event.scan_code_value] : unshifted_key_map[event.scan_code_value];
|
||||
|
|
Loading…
Reference in a new issue