1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +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

@ -348,8 +348,7 @@ void WindowManager::move_to_front_and_make_active(Window& window)
return IterationDecision::Continue;
});
auto* blocker = window.blocking_modal_window();
if (blocker && !window.is_capturing_input()) {
if (auto* blocker = window.blocking_modal_window()) {
blocker->window_stack().move_to_front(*blocker);
set_active_window(blocker, true);
} else {
@ -1230,7 +1229,7 @@ void WindowManager::process_mouse_event_for_window(HitTestResult& result, MouseE
// First check if we should initiate a move or resize (Super+LMB or Super+RMB).
// In those cases, the event is swallowed by the window manager.
if ((!blocking_modal_window || window.is_capturing_input()) && window.is_movable()) {
if (!blocking_modal_window && window.is_movable()) {
if (!window.is_fullscreen() && m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseDown && event.button() == MouseButton::Primary) {
start_window_move(window, event);
return;
@ -1248,7 +1247,7 @@ void WindowManager::process_mouse_event_for_window(HitTestResult& result, MouseE
set_active_window(&window);
}
if (blocking_modal_window && !window.is_capturing_input()) {
if (blocking_modal_window) {
if (event.type() == Event::Type::MouseDown) {
// We're clicking on something that's blocked by a modal window.
// Flash the modal window to let the user know about it.
@ -1835,8 +1834,7 @@ void WindowManager::notify_previous_active_input_window(Window& previous_input_w
void WindowManager::set_active_window(Window* new_active_window, bool make_input)
{
if (new_active_window) {
auto* blocker = new_active_window->blocking_modal_window();
if (blocker && !new_active_window->is_capturing_input()) {
if (auto* blocker = new_active_window->blocking_modal_window()) {
VERIFY(blocker->is_modal());
VERIFY(blocker != new_active_window);
new_active_window = blocker;