1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:37:34 +00:00

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.
This commit is contained in:
Andreas Kling 2020-04-19 11:59:11 +02:00
parent 2a9e29fbb8
commit 453b678346

View file

@ -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();