From 453b6783466503f5a94bc3c0e85702cd537d9e54 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 19 Apr 2020 11:59:11 +0200 Subject: [PATCH] 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. --- Servers/WindowServer/WindowManager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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();