From 946ed1f32ae8e3840d1b3bb04c6e048ca7501fba Mon Sep 17 00:00:00 2001 From: ParaN3xus <136563585+ParaN3xus@users.noreply.github.com> Date: Wed, 21 Aug 2024 18:24:42 +0800 Subject: core: add option to control which window to focus on close (#7368) --- src/events/Windows.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/events/Windows.cpp') diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 2eb7038f..e4e3900b 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -648,7 +648,12 @@ void Events::listener_unmapWindow(void* owner, void* data) { // refocus on a new window if needed if (wasLastWindow) { - const auto PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW); + static auto FOCUSONCLOSE = CConfigValue("input:focus_on_close"); + PHLWINDOW PWINDOWCANDIDATE = nullptr; + if (*FOCUSONCLOSE) + PWINDOWCANDIDATE = (g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING)); + else + PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW); Debug::log(LOG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE); -- cgit v1.2.3