From f40272d50954fd0995714b789215c938b2bd455d Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Tue, 25 Apr 2023 15:00:34 +0000 Subject: Add follow mouse mode to avoid refocusing under cursor (#2135) * Add follow mouse mode to avoid refocusing under cursor --- src/managers/input/InputManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/managers/input/InputManager.cpp') diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index bfe88678..4778ed3a 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -47,6 +47,7 @@ void CInputManager::simulateMouseMovement() { void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; + static auto* const PMOUSEREFOCUS = &g_pConfigManager->getConfigValuePtr("input:mouse_refocus")->intValue; static auto* const PMOUSEDPMS = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms")->intValue; static auto* const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue; static auto* const PHOGFOCUS = &g_pConfigManager->getConfigValuePtr("misc:layers_hog_keyboard_focus")->intValue; @@ -382,8 +383,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { m_bLastFocusOnLS = false; return; // don't enter any new surfaces } else { - if ((FOLLOWMOUSE != 3 && allowKeyboardRefocus) || refocus) + if (((FOLLOWMOUSE != 3 && allowKeyboardRefocus) && (*PMOUSEREFOCUS || m_pLastMouseFocus != pFoundWindow)) || refocus) { + m_pLastMouseFocus = pFoundWindow; g_pCompositor->focusWindow(pFoundWindow, foundSurface); + } } m_bLastFocusOnLS = false; -- cgit v1.2.3