fix: hide hw cursor on leave like hl

see e6cf643f5a
This commit is contained in:
Virt 2024-09-19 21:40:21 +02:00
commit ddfea3a29c

View file

@ -328,11 +328,25 @@ void CDynamicCursors::onCursorMoved(CPointerManager* pointers) {
if (!pointers->hasCursor())
return;
const auto CURSORBOX = pointers->getCursorBoxGlobal();
bool recalc = false;
for (auto& m : g_pCompositor->m_vMonitors) {
auto state = pointers->stateFor(m);
state->box = pointers->getCursorBoxLogicalForMonitor(state->monitor.lock());
auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty();
if (!CROSSES && state->cursorFrontBuffer) {
Debug::log(TRACE, "onCursorMoved for output {}: cursor left the viewport, removing it from the backend", m->szName);
pointers->setHWCursorBuffer(state, nullptr);
continue;
} else if (CROSSES && !state->cursorFrontBuffer) {
Debug::log(TRACE, "onCursorMoved for output {}: cursor entered the output, but no front buffer, forcing recalc", m->szName);
recalc = true;
}
if (state->hardwareFailed || !state->entered)
continue;
@ -340,6 +354,9 @@ void CDynamicCursors::onCursorMoved(CPointerManager* pointers) {
m->output->moveCursor(CURSORPOS);
}
if (recalc)
pointers->updateCursorBackend();
// ignore warp
if (!isMove && **PIGNORE_WARPS) {
auto mode = this->currentMode();