WindowServer: Fix non-submenus being closed when set as current menu

set_current_menu() was indiscriminately closing all menus when the
current menu is not a submenu. We should only close menus not in lineage
to the one being closed.
This commit is contained in:
Shannon Booth 2020-01-12 16:01:15 +13:00 committed by Andreas Kling
parent 4f6b9b64c3
commit e6c826ffc3
Notes: sideshowbarker 2024-07-19 10:09:16 +09:00

View file

@ -389,8 +389,12 @@ void WSMenuManager::open_menu(WSMenu& menu)
void WSMenuManager::set_current_menu(WSMenu* menu, bool is_submenu)
{
if (!is_submenu)
close_everyone();
if (!is_submenu) {
if (menu)
close_everyone_not_in_lineage(*menu);
else
close_everyone();
}
if (!menu) {
m_current_menu = nullptr;