From 793633ba4839018bc31f0d1ddf4b3de2039ead4f Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 15 Sep 2024 18:20:30 +0100 Subject: hide cursor on leave --- src/managers/PointerManager.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 6b2a40f5..90652526 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -307,6 +307,8 @@ void CPointerManager::resetCursorImage(bool apply) { void CPointerManager::updateCursorBackend() { static auto PNOHW = CConfigValue("cursor:no_hardware_cursors"); + const auto CURSORBOX = getCursorBoxGlobal(); + for (auto const& m : g_pCompositor->m_vMonitors) { auto state = stateFor(m); @@ -315,6 +317,17 @@ void CPointerManager::updateCursorBackend() { continue; } + auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty(); + + if (!CROSSES) { + if (state->cursorFrontBuffer) { + Debug::log(TRACE, "Output {}: cursor left the viewport, removing it from the backend", m->szName); + setHWCursorBuffer(state, nullptr); + } + + continue; + } + if (state->softwareLocks > 0 || *PNOHW || !attemptHardwareCursor(state)) { Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName); state->box = getCursorBoxLogicalForMonitor(state->monitor.lock()); -- cgit v1.2.3