summaryrefslogtreecommitdiff
path: root/src/config/shared/actions/ConfigActions.cpp
diff options
context:
space:
mode:
authorfazzi <18248986+fxzzi@users.noreply.github.com>2026-05-04 17:00:56 +0100
committerGitHub <noreply@github.com>2026-05-04 17:00:56 +0100
commiteff3bfe261e90b8950b59379ca7815f735a7aab6 (patch)
tree5d4bef57fdd9130c47fbd6a24772bbbd321d61c0 /src/config/shared/actions/ConfigActions.cpp
parent2824ffdda04d8471cd8a4ff30641ea06e4d80cf5 (diff)
windows/focus: add fallbacks when focussing workspaces (#14270)
Diffstat (limited to 'src/config/shared/actions/ConfigActions.cpp')
-rw-r--r--src/config/shared/actions/ConfigActions.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/config/shared/actions/ConfigActions.cpp b/src/config/shared/actions/ConfigActions.cpp
index 7111afd8..56fb88e9 100644
--- a/src/config/shared/actions/ConfigActions.cpp
+++ b/src/config/shared/actions/ConfigActions.cpp
@@ -94,7 +94,7 @@ static bool tryMoveFocusToMonitor(PHLMONITOR monitor) {
const auto PNEWMAINWORKSPACE = monitor->m_activeWorkspace;
const auto PNEWWORKSPACE = monitor->m_activeSpecialWorkspace ? monitor->m_activeSpecialWorkspace : PNEWMAINWORKSPACE;
- const auto PNEWWINDOW = PNEWWORKSPACE->getLastFocusedWindow();
+ auto PNEWWINDOW = PNEWWORKSPACE->getFocusCandidate();
if (PNEWWINDOW) {
updateRelativeCursorCoords();
@@ -931,11 +931,13 @@ ActionResult Actions::changeWorkspace(PHLWORKSPACE ws) {
PMONITORWORKSPACEOWNER->changeWorkspace(ws, false, true);
if (PMONITOR != PMONITORWORKSPACEOWNER) {
- Vector2D middle = PMONITORWORKSPACEOWNER->middle();
- if (const auto PLAST = ws->getLastFocusedWindow(); PLAST) {
- Desktop::focusState()->fullWindowFocus(PLAST, Desktop::FOCUS_REASON_KEYBIND);
+ Vector2D middle = PMONITORWORKSPACEOWNER->middle();
+ auto pWindow = ws->getFocusCandidate();
+
+ if (pWindow) {
+ Desktop::focusState()->fullWindowFocus(pWindow, Desktop::FOCUS_REASON_KEYBIND);
if (*PWORKSPACECENTERON == 1)
- middle = PLAST->middle();
+ middle = pWindow->middle();
}
g_pCompositor->warpCursorTo(middle);
}