From ba0c5fe0bba9ac671f4238b968e4728671eef3f8 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 4 Sep 2022 18:42:11 +0200 Subject: [PATCH] fix mouse focus not returning from a LS on follow mouse 0 --- src/managers/input/InputManager.cpp | 14 +++++++++++--- src/managers/input/InputManager.hpp | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index e4173a6d..af950b5b 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -269,9 +269,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y); } - if (pFoundWindow == g_pCompositor->m_pLastWindow && foundSurface != g_pCompositor->m_pLastFocus) { - // we changed the subsurface - wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y); + if (pFoundWindow == g_pCompositor->m_pLastWindow) { + if (foundSurface != g_pCompositor->m_pLastFocus || m_bLastFocusOnLS) { + // ^^^ changed the subsurface ^^^ came back from a LS + wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y); + } } if (*PFOLLOWONDND && m_sDrag.dragIcon) { @@ -279,16 +281,22 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { } wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y); + m_bLastFocusOnLS = false; return; // don't enter any new surfaces } else { if ((*PFOLLOWMOUSE != 3 && allowKeyboardRefocus) || refocus) g_pCompositor->focusWindow(pFoundWindow, foundSurface); } + + m_bLastFocusOnLS = false; } else { if (pFoundLayerSurface && pFoundLayerSurface->layerSurface->current.keyboard_interactive && *PFOLLOWMOUSE != 3 && allowKeyboardRefocus) { g_pCompositor->focusSurface(foundSurface); g_pCompositor->m_pLastWindow = nullptr; // reset last window as we have a full focus on a LS } + + if (pFoundLayerSurface) + m_bLastFocusOnLS = true; } wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y); diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index aed91584..82d047f3 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -105,6 +105,9 @@ private: bool m_bEmptyFocusCursorSet = false; Vector2D m_vLastCursorPosFloored = Vector2D(); + // for some bugs in follow mouse 0 + bool m_bLastFocusOnLS = false; + void processMouseDownNormal(wlr_pointer_button_event* e); void processMouseDownKill(wlr_pointer_button_event* e);