summaryrefslogtreecommitdiff
path: root/Servers/WindowServer
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-19 11:59:11 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-19 12:09:48 +0200
commit453b6783466503f5a94bc3c0e85702cd537d9e54 (patch)
treee1597f065a89ffd378a513decd03ca3561825eed /Servers/WindowServer
parent2a9e29fbb886b430d5966bfbe0342d84286aef37 (diff)
downloadserenity-453b6783466503f5a94bc3c0e85702cd537d9e54.zip
WindowServer: Don't automatically focus desktop window when added
Normally we focus any window that's added to the window stack. However, for WindowType::Desktop this gets annoying since if the desktop manager comes up after other GUI processes have already started, it steals the focus from them. Solve this by only auto-focusing desktop windows if they are the very first window added.
Diffstat (limited to 'Servers/WindowServer')
-rw-r--r--Servers/WindowServer/WindowManager.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Servers/WindowServer/WindowManager.cpp b/Servers/WindowServer/WindowManager.cpp
index ce28c5bbd5..6521aa4411 100644
--- a/Servers/WindowServer/WindowManager.cpp
+++ b/Servers/WindowServer/WindowManager.cpp
@@ -169,6 +169,8 @@ Gfx::Size WindowManager::resolution() const
void WindowManager::add_window(Window& window)
{
+ bool is_first_window = m_windows_in_order.is_empty();
+
m_windows_in_order.append(&window);
if (window.is_fullscreen()) {
@@ -176,7 +178,9 @@ void WindowManager::add_window(Window& window)
window.set_rect(Screen::the().rect());
}
- set_active_window(&window);
+ if (window.type() != WindowType::Desktop || is_first_window)
+ set_active_window(&window);
+
if (m_switcher.is_visible() && window.type() != WindowType::WindowSwitcher)
m_switcher.refresh();