summaryrefslogtreecommitdiff
path: root/Servers
diff options
context:
space:
mode:
Diffstat (limited to 'Servers')
-rw-r--r--Servers/WindowServer/WSMenuManager.cpp9
-rw-r--r--Servers/WindowServer/WSMenuManager.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/Servers/WindowServer/WSMenuManager.cpp b/Servers/WindowServer/WSMenuManager.cpp
index ed55f4a579..0e02231066 100644
--- a/Servers/WindowServer/WSMenuManager.cpp
+++ b/Servers/WindowServer/WSMenuManager.cpp
@@ -382,6 +382,15 @@ void WSMenuManager::close_menu_and_descendants(WSMenu& menu)
close_menus(menus_to_close);
}
+void WSMenuManager::toggle_menu(WSMenu& menu)
+{
+ if (is_open(menu)) {
+ close_menu_and_descendants(menu);
+ return;
+ }
+ open_menu(menu);
+}
+
void WSMenuManager::open_menu(WSMenu& menu)
{
if (is_open(menu))
diff --git a/Servers/WindowServer/WSMenuManager.h b/Servers/WindowServer/WSMenuManager.h
index 4fd9e1d544..641eee428a 100644
--- a/Servers/WindowServer/WSMenuManager.h
+++ b/Servers/WindowServer/WSMenuManager.h
@@ -32,6 +32,7 @@ public:
WSMenu* current_menu() { return m_current_menu.ptr(); }
void set_current_menu(WSMenu*, bool is_submenu = false);
void open_menu(WSMenu&);
+ void toggle_menu(WSMenu&);
WSMenuBar* current_menubar() { return m_current_menubar.ptr(); }
void set_current_menubar(WSMenuBar*);