summaryrefslogtreecommitdiff
path: root/Servers/WindowServer/WSMenuManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Servers/WindowServer/WSMenuManager.cpp')
-rw-r--r--Servers/WindowServer/WSMenuManager.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/Servers/WindowServer/WSMenuManager.cpp b/Servers/WindowServer/WSMenuManager.cpp
index e6f6ba73f8..efae9eb5fa 100644
--- a/Servers/WindowServer/WSMenuManager.cpp
+++ b/Servers/WindowServer/WSMenuManager.cpp
@@ -145,7 +145,10 @@ void WSMenuManager::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& ev
bool is_mousedown_with_left_button = event.type() == WSMouseEvent::MouseDown && event.button() == MouseButton::Left;
bool should_open_menu = &menu != m_current_menu && (is_hover_with_any_menu_open || is_mousedown_with_left_button);
- if (should_open_menu) {
+ if (is_mousedown_with_left_button)
+ m_bar_open = !m_bar_open;
+
+ if (should_open_menu && m_bar_open) {
if (m_current_menu == &menu)
return;
close_everyone();
@@ -158,11 +161,9 @@ void WSMenuManager::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& ev
refresh();
return;
}
- if (event.type() == WSMouseEvent::MouseDown && event.button() == MouseButton::Left) {
+
+ if (!m_bar_open)
close_everyone();
- set_current_menu(nullptr);
- return;
- }
}
void WSMenuManager::set_needs_window_resize()
@@ -177,6 +178,7 @@ void WSMenuManager::close_everyone()
menu->menu_window()->set_visible(false);
}
m_open_menu_stack.clear();
+ m_current_menu = nullptr;
refresh();
}
@@ -240,3 +242,9 @@ void WSMenuManager::set_current_menu(WSMenu* menu, bool is_submenu)
m_open_menu_stack.append(menu->make_weak_ptr());
}
}
+
+void WSMenuManager::close_bar()
+{
+ close_everyone();
+ m_bar_open = false;
+}