From 325061b0e4e02b2b177b2e34324339690f5ed93d Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Thu, 17 Nov 2022 09:43:19 -0500 Subject: [PATCH] WindowServer: Add misbehavior restriction for Blocking modals Two Blocking modals in the same modal chain which aren't descended one from the other will block each other's input rendering the chain noninteractive. This has caused confusion in the past for builders so this warning makes the behavior explicitly forbidden. --- Userland/Services/WindowServer/ConnectionFromClient.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index f39ca5309d..a715decadb 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -599,6 +599,11 @@ void ConnectionFromClient::create_window(i32 window_id, Gfx::IntRect const& rect did_misbehave("CreateWindow with bad parent_window_id"); return; } + + if (auto* blocker = parent_window->blocking_modal_window(); blocker && mode == (i32)WindowMode::Blocking) { + did_misbehave("CreateWindow with illegal mode: reciprocally blocked"); + return; + } } if (type < 0 || type >= (i32)WindowType::_Count) {