mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:07:45 +00:00
WindowServer: Replace modal stacks with modal chains
And apply modal effects on move_to_front_and_make_active() Instead of building a vector of windows every time we want to loop over a group of related modals, simply recurse through their ancestory. This lineage is now called a modal chain. Modal chains begin at the first modeless parent, and a new chain starts at every modeless child. This lets apps spawn child windows independent of the main window's modal effects, restore state, and workspace, yet still remain descendants. Looping through a modal chain is recursive and includes the modeless window which begins it.
This commit is contained in:
parent
4c7f95e2f8
commit
788b16cbf8
3 changed files with 55 additions and 72 deletions
|
@ -679,18 +679,12 @@ bool Window::is_active() const
|
|||
|
||||
Window* Window::blocking_modal_window()
|
||||
{
|
||||
// A window is blocked if any immediate child, or any child further
|
||||
// down the chain is modal
|
||||
for (auto& window : m_child_windows) {
|
||||
if (window && !window->is_destroyed()) {
|
||||
if (window->is_modal())
|
||||
return window;
|
||||
|
||||
if (auto* blocking_window = window->blocking_modal_window())
|
||||
return blocking_window;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
auto maybe_blocker = WindowManager::the().for_each_window_in_modal_chain(*this, [&](auto& window) {
|
||||
if (window.is_blocking() && this != &window)
|
||||
return IterationDecision::Break;
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return maybe_blocker;
|
||||
}
|
||||
|
||||
void Window::set_default_icon()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue