summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer
diff options
context:
space:
mode:
authorJean-Baptiste Boric <jblbeurope@gmail.com>2021-01-26 19:36:09 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-15 19:37:14 +0100
commit7ee6c66ee95ad151c24d34c259464db03fb7ea6b (patch)
tree01a0d2445c586dcd0116446655c9a8ef43930242 /Userland/Services/WindowServer
parentc51209a06a249e00fccfe1fc941312051983fff8 (diff)
downloadserenity-7ee6c66ee95ad151c24d34c259464db03fb7ea6b.zip
WindowManager: Make the Logo key open the system menu
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp17
-rw-r--r--Userland/Services/WindowServer/WindowManager.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index d9b3c729a3..8471910c98 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -1087,6 +1087,9 @@ Gfx::IntRect WindowManager::arena_rect_for_type(WindowType type) const
void WindowManager::event(Core::Event& event)
{
if (static_cast<Event&>(event).is_mouse_event()) {
+ if (event.type() != Event::MouseMove)
+ m_previous_event_is_key_down_logo = false;
+
Window* hovered_window = nullptr;
process_mouse_event(static_cast<MouseEvent&>(event), hovered_window);
set_hovered_window(hovered_window);
@@ -1116,6 +1119,20 @@ void WindowManager::event(Core::Event& event)
return;
}
+ if (key_event.type() == Event::KeyDown && key_event.key() == Key_Logo) {
+ m_previous_event_is_key_down_logo = true;
+ } else if (m_previous_event_is_key_down_logo) {
+ m_previous_event_is_key_down_logo = false;
+ if (key_event.type() == Event::KeyUp && key_event.key() == Key_Logo) {
+ if (MenuManager::the().has_open_menu()) {
+ MenuManager::the().close_everyone();
+ } else {
+ MenuManager::the().open_menu(*MenuManager::the().system_menu());
+ }
+ return;
+ }
+ }
+
if (MenuManager::the().current_menu()) {
MenuManager::the().dispatch_event(event);
return;
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h
index 21cb345f85..84673fd0f5 100644
--- a/Userland/Services/WindowServer/WindowManager.h
+++ b/Userland/Services/WindowServer/WindowManager.h
@@ -353,6 +353,8 @@ private:
String m_dnd_text;
RefPtr<Core::MimeData> m_dnd_mime_data;
RefPtr<Gfx::Bitmap> m_dnd_bitmap;
+
+ bool m_previous_event_is_key_down_logo { false };
};
template<typename Callback>