warp only on another monitor in changeworkspace

This commit is contained in:
vaxerski 2022-08-31 21:39:27 +02:00
parent dacaf72e02
commit f77fac9df9
1 changed files with 4 additions and 2 deletions

View File

@ -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 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; Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
g_pCompositor->warpCursorTo(middle); g_pCompositor->warpCursorTo(middle);
} }
@ -653,7 +654,8 @@ void CKeybindManager::changeworkspace(std::string args) {
// focus // focus
if (const auto PWINDOW = PWORKSPACETOCHANGETO->m_pLastFocusedWindow; g_pCompositor->windowValidMapped(PWINDOW)) { if (const auto PWINDOW = PWORKSPACETOCHANGETO->m_pLastFocusedWindow; g_pCompositor->windowValidMapped(PWINDOW)) {
// warp and focus // 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)); g_pCompositor->focusWindow(PWINDOW, g_pXWaylandManager->getWindowSurface(PWINDOW));
} else } else
g_pInputManager->refocus(); g_pInputManager->refocus();