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

WindowServer: Remove misbehavior conditions for modals

This was too restrictive and there are already UI elements that rely
on this behavior. Now Blocking modals will preempt interaction with
all windows in their modal chain except those descending from them.
Fixes crashing in FilePicker when permission is denied.
This commit is contained in:
thankyouverycool 2022-08-27 16:48:11 -04:00 committed by Linus Groh
parent b2b68a7551
commit 1dd9086e1a
5 changed files with 14 additions and 18 deletions

View file

@ -442,7 +442,7 @@ void Window::event(Core::Event& event)
return;
}
if (blocking_modal_window() && !is_capturing_input()) {
if (blocking_modal_window()) {
// We still want to handle the WindowDeactivated event below when a new modal is
// created to notify its parent window, despite it being "blocked by modal window".
if (event.type() != Event::WindowDeactivated)
@ -660,6 +660,8 @@ bool Window::is_active() const
Window* Window::blocking_modal_window()
{
auto maybe_blocker = WindowManager::the().for_each_window_in_modal_chain(*this, [&](auto& window) {
if (is_descendant_of(window))
return IterationDecision::Continue;
if (window.is_blocking() && this != &window)
return IterationDecision::Break;
return IterationDecision::Continue;