From 3cca36e7738559bbc72ac8fc99eaca3e3d94c0cb Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 15 Feb 2024 01:24:40 +0000 Subject: [PATCH] input: avoid rampant refocuses on popups --- src/managers/input/InputManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 76fcf1df..baf648df 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -422,8 +422,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { return; // don't enter any new surfaces } else { if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_pLastMouseFocus != pFoundWindow)) || refocus)) { - m_pLastMouseFocus = pFoundWindow; - g_pCompositor->focusWindow(pFoundWindow, foundSurface); + if (m_pLastMouseFocus != pFoundWindow || g_pCompositor->m_pLastFocus != foundSurface) { + m_pLastMouseFocus = pFoundWindow; + + // TODO: this looks wrong. When over a popup, it constantly is switching. + // Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit. + if (m_pLastMouseFocus != pFoundWindow) + g_pCompositor->focusWindow(pFoundWindow, foundSurface); + else + g_pCompositor->focusSurface(foundSurface, pFoundWindow); + } } }