1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:17:35 +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)

View file

@ -184,6 +184,7 @@ public:
bool is_modal() const;
bool is_modal_dont_unparent() const { return m_modal && m_parent_window; }
Window* modeless_ancestor();
Gfx::IntRect rect() const { return m_rect; }
void set_rect(Gfx::IntRect const&);