diff --git a/Kernel/KeyCode.h b/Kernel/KeyCode.h index 558ebcfcdc..31e9dd13e6 100644 --- a/Kernel/KeyCode.h +++ b/Kernel/KeyCode.h @@ -107,13 +107,15 @@ enum KeyCode : byte { Key_Pipe, Key_Tilde, Key_Backtick, + Key_Logo, }; enum KeyModifier { Mod_Alt = 0x01, Mod_Ctrl = 0x02, Mod_Shift = 0x04, - Mod_Mask = 0x07, + Mod_Logo = 0x08, + Mod_Mask = 0x0f, Is_Press = 0x80, }; @@ -125,6 +127,7 @@ struct KeyEvent { bool alt() const { return flags & Mod_Alt; } bool ctrl() const { return flags & Mod_Ctrl; } bool shift() const { return flags & Mod_Shift; } + bool logo() const { return flags & Mod_Logo; } unsigned modifiers() const { return flags & Mod_Mask; } bool is_press() const { return flags & Is_Press; } }; diff --git a/Kernel/KeyboardDevice.cpp b/Kernel/KeyboardDevice.cpp index 8bbc8c76a1..456157017a 100644 --- a/Kernel/KeyboardDevice.cpp +++ b/Kernel/KeyboardDevice.cpp @@ -72,6 +72,9 @@ static KeyCode unshifted_key_map[0x80] = Key_Invalid, Key_F11, Key_F12, + Key_Invalid, + Key_Invalid, + Key_Logo, }; static KeyCode shifted_key_map[0x100] = @@ -111,6 +114,9 @@ static KeyCode shifted_key_map[0x100] = Key_Invalid, Key_F11, Key_F12, + Key_Invalid, + Key_Invalid, + Key_Logo, }; void KeyboardDevice::key_state_changed(byte raw, bool pressed) @@ -143,6 +149,9 @@ void KeyboardDevice::handle_irq() case 0x38: update_modifier(Mod_Alt, pressed); break; case 0x1d: update_modifier(Mod_Ctrl, pressed); break; case 0x2a: update_modifier(Mod_Shift, pressed); break; + case 0x5b: update_modifier(Mod_Logo, pressed); break; + } + switch (ch) { case I8042_ACK: break; default: if (m_modifiers & Mod_Alt) { diff --git a/LibGUI/GEvent.h b/LibGUI/GEvent.h index 278835e9be..ad1681817b 100644 --- a/LibGUI/GEvent.h +++ b/LibGUI/GEvent.h @@ -124,6 +124,7 @@ public: bool ctrl() const { return m_modifiers & Mod_Ctrl; } bool alt() const { return m_modifiers & Mod_Alt; } bool shift() const { return m_modifiers & Mod_Shift; } + bool logo() const { return m_modifiers & Mod_Logo; } byte modifiers() const { return m_modifiers; } String text() const { return m_text; } diff --git a/LibGUI/GShortcut.cpp b/LibGUI/GShortcut.cpp index 7673133820..7aa946d1dd 100644 --- a/LibGUI/GShortcut.cpp +++ b/LibGUI/GShortcut.cpp @@ -124,6 +124,8 @@ String GShortcut::to_string() const parts.append("Shift"); if (m_modifiers & Mod_Alt) parts.append("Alt"); + if (m_modifiers & Mod_Logo) + parts.append("Logo"); parts.append(::to_string(m_key)); diff --git a/WindowServer/WSMessage.h b/WindowServer/WSMessage.h index 9981eb19af..0dd4dd910b 100644 --- a/WindowServer/WSMessage.h +++ b/WindowServer/WSMessage.h @@ -463,6 +463,7 @@ public: bool ctrl() const { return m_modifiers & Mod_Ctrl; } bool alt() const { return m_modifiers & Mod_Alt; } bool shift() const { return m_modifiers & Mod_Shift; } + bool logo() const { return m_modifiers & Mod_Logo; } byte modifiers() const { return m_modifiers; } char character() const { return m_character; } diff --git a/WindowServer/WSWindowManager.cpp b/WindowServer/WSWindowManager.cpp index 0913c09b14..786d2b4778 100644 --- a/WindowServer/WSWindowManager.cpp +++ b/WindowServer/WSWindowManager.cpp @@ -756,7 +756,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_ move_to_front(window); set_active_window(&window); } - if (event.type() == WSMessage::MouseDown && event.button() == MouseButton::Right) { + if (m_keyboard_modifiers == Mod_Logo && event.type() == WSMessage::MouseDown && event.button() == MouseButton::Right) { start_window_resize(window, event); return IterationDecision::Abort; } @@ -984,6 +984,7 @@ void WSWindowManager::on_message(WSMessage& message) if (message.is_key_event()) { // FIXME: This is a good place to hook key events globally. :) + m_keyboard_modifiers = static_cast(message).modifiers(); if (m_active_window) return m_active_window->on_message(message); return; diff --git a/WindowServer/WSWindowManager.h b/WindowServer/WSWindowManager.h index 9ac5db19ae..c1f60cbe04 100644 --- a/WindowServer/WSWindowManager.h +++ b/WindowServer/WSWindowManager.h @@ -150,6 +150,8 @@ private: bool m_flash_flush { false }; bool m_buffers_are_flipped { false }; + byte m_keyboard_modifiers { 0 }; + OwnPtr m_system_menu; Color m_menu_selection_color; WeakPtr m_current_menubar;