From 7c1ac58a4bfc67addf10a2bd2497e71da923eba3 Mon Sep 17 00:00:00 2001 From: dranull <150595692+dranull@users.noreply.github.com> Date: Mon, 1 Jan 2024 12:02:16 +0000 Subject: [PATCH] input: Ignore some input events when focus is on a layer surface (#4306) * No motion events with focus on LS on workspace change * Don't check scroll events on decorations with focus on LS --- src/managers/KeybindManager.cpp | 10 ++++++---- src/managers/input/InputManager.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index fc3fcf0d..899003d8 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -880,10 +880,12 @@ void CKeybindManager::changeworkspace(std::string args) { } else pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE); - if (!g_pCompositor->m_pLastFocus) - g_pInputManager->simulateMouseMovement(); - else - g_pInputManager->sendMotionEventsToFocused(); + if (!g_pInputManager->m_bLastFocusOnLS) { + if (g_pCompositor->m_pLastFocus) + g_pInputManager->sendMotionEventsToFocused(); + else + g_pInputManager->simulateMouseMovement(); + } } void CKeybindManager::fullscreenActive(std::string args) { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 78058a8a..207df738 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -687,11 +687,13 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) { if (!passEvent) return; - const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); - const auto PWINDOW = g_pCompositor->vectorToWindowIdeal(MOUSECOORDS); + if (!m_bLastFocusOnLS) { + const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); + const auto PWINDOW = g_pCompositor->vectorToWindowIdeal(MOUSECOORDS); - if (PWINDOW && PWINDOW->checkInputOnDecos(INPUT_TYPE_AXIS, MOUSECOORDS, e)) - return; + if (PWINDOW && PWINDOW->checkInputOnDecos(INPUT_TYPE_AXIS, MOUSECOORDS, e)) + return; + } wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, factor * e->delta, std::round(factor * e->delta_discrete), e->source); }