WindowServer: Add MenuManager helper to find closest open ancestor

This commit is contained in:
thankyouverycool 2022-08-16 06:54:29 -04:00 committed by Andreas Kling
parent db852548ce
commit 4489f9dbef
Notes: sideshowbarker 2024-07-18 02:47:59 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -229,6 +229,14 @@ void MenuManager::close_everyone()
clear_current_menu();
}
Menu* MenuManager::closest_open_ancestor_of(Menu const& other) const
{
for (auto& menu : m_open_menu_stack.in_reverse())
if (menu->is_menu_ancestor_of(other))
return menu.ptr();
return nullptr;
}
void MenuManager::close_everyone_not_in_lineage(Menu& menu)
{
Vector<Menu&> menus_to_close;