1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

WindowServer: Fix picking new active window after destroy

We need to mark windows as destroyed and not consider them
when picking a new active window. Fixes lost focus after
closing some windows.
This commit is contained in:
Tom 2020-07-16 11:08:39 -06:00 committed by Andreas Kling
parent 603c17262c
commit f591157eb8
4 changed files with 29 additions and 7 deletions

View file

@ -126,6 +126,12 @@ Window::~Window()
WindowManager::the().remove_window(*this);
}
void Window::destroy()
{
m_destroyed = true;
invalidate();
}
void Window::set_title(const String& title)
{
if (m_title == title)
@ -389,7 +395,7 @@ Window* Window::is_blocked_by_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) {
if (window && !window->is_destroyed()) {
if (window->is_modal())
return window;