mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:17:34 +00:00
Userland: Actually use the correct character map index from KeyEvent
Instead of using a scan code, which for scan code set 2 will not represent the expected character mapping index, we could just use another variable in the KeyEvent structure that correctly points to the character index. This change is mostly relevant to the KeyboardMapper application, and also to the WindowServer code, as both handle KeyEvents and need to use the character mapping index in various situations.
This commit is contained in:
parent
b89cc81674
commit
60a96b3786
9 changed files with 41 additions and 32 deletions
|
@ -386,9 +386,10 @@ enum MouseButton : u8 {
|
|||
|
||||
class KeyEvent final : public Event {
|
||||
public:
|
||||
KeyEvent(Type type, KeyCode key, u8 modifiers, u32 code_point, u32 scancode)
|
||||
KeyEvent(Type type, KeyCode key, u8 map_entry_index, u8 modifiers, u32 code_point, u32 scancode)
|
||||
: Event(type)
|
||||
, m_key(key)
|
||||
, m_map_entry_index(map_entry_index)
|
||||
, m_modifiers(modifiers)
|
||||
, m_code_point(code_point)
|
||||
, m_scancode(scancode)
|
||||
|
@ -411,6 +412,8 @@ public:
|
|||
}
|
||||
u32 scancode() const { return m_scancode; }
|
||||
|
||||
u8 map_entry_index() const { return m_map_entry_index; }
|
||||
|
||||
ByteString to_byte_string() const;
|
||||
|
||||
bool is_arrow_key() const
|
||||
|
@ -429,6 +432,7 @@ public:
|
|||
private:
|
||||
friend class ConnectionToWindowServer;
|
||||
KeyCode m_key { KeyCode::Key_Invalid };
|
||||
u8 m_map_entry_index { 0 };
|
||||
u8 m_modifiers { 0 };
|
||||
u32 m_code_point { 0 };
|
||||
u32 m_scancode { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue