diff --git a/src/Compositor.cpp b/src/Compositor.cpp index ea5faf63..a56a9249 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -878,7 +878,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { const auto PWORKSPACE = getWorkspaceByID(pWindow->m_iWorkspaceID); PWORKSPACE->m_pLastFocusedWindow = pWindow; const auto PMONITOR = getMonitorFromID(PWORKSPACE->m_iMonitorID); - PMONITOR->changeWorkspace(PWORKSPACE); + PMONITOR->changeWorkspace(PWORKSPACE, false, true); // changeworkspace already calls focusWindow return; } diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 4bb530b5..c1443d40 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -494,7 +494,7 @@ float CMonitor::getDefaultScale() { return 1; } -void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal) { +void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal, bool noMouseMove) { if (!pWorkspace) return; @@ -543,8 +543,8 @@ void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal) { g_pCompositor->focusWindow(pWindow); } - - g_pInputManager->simulateMouseMovement(); + if (!noMouseMove) + g_pInputManager->simulateMouseMovement(); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID); diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 9e6fecc5..11dad9f6 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -102,7 +102,7 @@ class CMonitor { void setMirror(const std::string&); bool isMirror(); float getDefaultScale(); - void changeWorkspace(CWorkspace* const pWorkspace, bool internal = false); + void changeWorkspace(CWorkspace* const pWorkspace, bool internal = false, bool noMouseMove = false); void changeWorkspace(const int& id, bool internal = false); void setSpecialWorkspace(CWorkspace* const pWorkspace); void setSpecialWorkspace(const int& id);