1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:17:46 +00:00

WindowServer: Add modeless_ancestor() helper

This commit is contained in:
thankyouverycool 2022-08-24 06:23:25 -04:00 committed by Andreas Kling
parent ab517aa21d
commit 609391b46e
2 changed files with 12 additions and 0 deletions

View file

@ -989,6 +989,17 @@ void Window::set_parent_window(Window& parent_window)
parent_window.add_child_window(*this);
}
Window* Window::modeless_ancestor()
{
if (!is_modal())
return this;
for (auto parent = m_parent_window; parent; parent = parent->parent_window()) {
if (!parent->is_modal())
return parent;
}
return nullptr;
}
bool Window::is_accessory() const
{
if (!m_accessory)