From 434719611d4295f7fab72f969d40ac32cbd7865a Mon Sep 17 00:00:00 2001 From: vaxerski Date: Fri, 20 Jan 2023 20:57:35 +0100 Subject: [PATCH] fix focus history on workspace jumps --- src/Compositor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 574c9575..f5918192 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -808,8 +808,14 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { if (pWindow->m_bPinned) pWindow->m_iWorkspaceID = m_pLastMonitor->activeWorkspace; - if (!isWorkspaceVisible(pWindow->m_iWorkspaceID)) + if (!isWorkspaceVisible(pWindow->m_iWorkspaceID)) { + // This is to fix incorrect feedback on the focus history. + const auto PWORKSPACE = getWorkspaceByID(pWindow->m_iWorkspaceID); + PWORKSPACE->m_pLastFocusedWindow = pWindow; g_pKeybindManager->changeworkspace("[internal]" + std::to_string(pWindow->m_iWorkspaceID)); + // changeworkspace already calls focusWindow + return; + } const auto PLASTWINDOW = m_pLastWindow; m_pLastWindow = pWindow;