diff options
author | Jami Kettunen <jami.kettunen@protonmail.com> | 2020-01-04 13:04:36 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-04 14:58:50 +0100 |
commit | a641f4d213bc957dc7ea515b925a8275332e8042 (patch) | |
tree | 9c9360e6b70c09340f01e6a6b6c2fffb5be63e9d /Servers | |
parent | c663b1034a0569bee92ebcf1ac66cc0551614875 (diff) | |
download | serenity-a641f4d213bc957dc7ea515b925a8275332e8042.zip |
WindowServer: Set no active window if no new candidates are available
Diffstat (limited to 'Servers')
-rw-r--r-- | Servers/WindowServer/WSWindowManager.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index 3470cb7d89..8918b41357 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -348,8 +348,6 @@ void WSWindowManager::remove_window(WSWindow& window) m_windows_in_order.remove(&window); if (window.is_active()) pick_new_active_window(); - if (m_active_window.ptr() == &window) - set_active_window(nullptr); if (m_switcher.is_visible() && window.type() != WSWindowType::WindowSwitcher) m_switcher.refresh(); @@ -489,10 +487,14 @@ void WSWindowManager::notify_occlusion_state_changed(WSWindow& window) void WSWindowManager::pick_new_active_window() { + bool new_window_picked = false; for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, [&](WSWindow& candidate) { set_active_window(&candidate); + new_window_picked = true; return IterationDecision::Break; }); + if (!new_window_picked) + set_active_window(nullptr); } void WSWindowManager::start_window_move(WSWindow& window, const WSMouseEvent& event) |