From 664827473583f8e986f9fb2a37a13e9b3a232cc2 Mon Sep 17 00:00:00 2001 From: memchr <118117622+memchr@users.noreply.github.com> Date: Fri, 8 Sep 2023 17:17:04 +0000 Subject: fix: focusWindow on hidden workspace triggers another focusWindow. (#3216) This commit address an issue where focusing a window on a hidden workspace inadvertently triggered a second `focusWindow` call due to simulated mouse movement. This behaviour led to the incorrect focus on the window under the cursor instead of target window of method `focusWindow()`, disrupting `focusurgentorlast` and `focuscurrentorlast` dispatchers. Introduced a flag to the `CMonitor::changeWorkspace()` method to prevent simulated mouse movements. This flag is set to false by default. Changed the `focusWindow()` method accordingly to set this flag to true when the target window is in a hidden workspace. --- src/helpers/Monitor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/helpers/Monitor.cpp') 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); -- cgit v1.2.3