summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-31 21:39:27 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-31 21:39:27 +0200
commitf77fac9df9c6619fe70f2b951a623095ed9d753a (patch)
treeff97161cb5adf21b93df20f73fd0a8f7e2635cc5 /src/managers/KeybindManager.cpp
parentdacaf72e02b8d1819135f6aef3911e8211e98630 (diff)
warp only on another monitor in changeworkspace
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index bf926c6e..fb70eb11 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -636,7 +636,8 @@ void CKeybindManager::changeworkspace(std::string args) {
}
// If the monitor is not the one our cursor's at, warp to it.
- if (PMONITOR != g_pCompositor->getMonitorFromCursor()) {
+ const bool anotherMonitor = PMONITOR != g_pCompositor->getMonitorFromCursor();
+ if (anotherMonitor) {
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
g_pCompositor->warpCursorTo(middle);
}
@@ -653,7 +654,8 @@ void CKeybindManager::changeworkspace(std::string args) {
// focus
if (const auto PWINDOW = PWORKSPACETOCHANGETO->m_pLastFocusedWindow; g_pCompositor->windowValidMapped(PWINDOW)) {
// warp and focus
- g_pCompositor->warpCursorTo(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f);
+ if (anotherMonitor)
+ g_pCompositor->warpCursorTo(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f);
g_pCompositor->focusWindow(PWINDOW, g_pXWaylandManager->getWindowSurface(PWINDOW));
} else
g_pInputManager->refocus();