From d458592fb12cadb66ca7806ccd266417c67f4f7e Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 15 Nov 2024 20:41:42 +0200 Subject: [PATCH] WindowServer: Don't focus unfocusable windows on window creation --- userspace/programs/WindowServer/WindowServer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/userspace/programs/WindowServer/WindowServer.cpp b/userspace/programs/WindowServer/WindowServer.cpp index 5f77fd6a..c880d883 100644 --- a/userspace/programs/WindowServer/WindowServer.cpp +++ b/userspace/programs/WindowServer/WindowServer.cpp @@ -85,7 +85,10 @@ void WindowServer::on_window_create(int fd, const LibGUI::WindowPacket::WindowCr window_popper.disable(); - set_focused_window(window); + if (packet.attributes.focusable) + set_focused_window(window); + else if (m_client_windows.size() > 1) + BAN::swap(m_client_windows[m_client_windows.size() - 1], m_client_windows[m_client_windows.size() - 2]); } void WindowServer::on_window_invalidate(int fd, const LibGUI::WindowPacket::WindowInvalidate& packet)