diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 85699b14c..6129a9d6f 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -176,6 +176,16 @@ void CInputManager::sendMotionEventsToFocused() { if (!Desktop::focusState()->surface() || isConstrained()) return; + const auto POINTERSURF = g_pSeatManager->m_state.pointerFocus.lock(); + if (POINTERSURF) { + const auto POINTERHLSURF = Desktop::View::CWLSurface::fromResource(POINTERSURF); + + // Keep pointer focus on desktop components such as bars or popups that are + // currently under the cursor. Keyboard focus changes should not steal it. + if (POINTERHLSURF && (!POINTERHLSURF->view() || POINTERHLSURF->view()->type() != Desktop::View::VIEW_TYPE_WINDOW)) + return; + } + const auto SURF = Desktop::focusState()->surface(); if (!SURF)