From e2b72b2975782719759b989853578db95671b069 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 30 Sep 2023 16:55:41 +0100 Subject: [PATCH] renderer: avoid spamming software cursor locks --- src/render/Renderer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 2e35efa8..ea6a246a 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -884,7 +884,14 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { } } - pMonitor->activelyTearing = shouldTear; + if (pMonitor->activelyTearing != shouldTear) { + // change of state + pMonitor->activelyTearing = shouldTear; + + for (auto& m : g_pCompositor->m_vMonitors) { + wlr_output_lock_software_cursors(m->output, pMonitor->activelyTearing); + } + } EMIT_HOOK_EVENT("preRender", pMonitor); @@ -1025,7 +1032,6 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { TRACY_GPU_ZONE("RenderCursor"); bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && *PZOOMFACTOR != 1.f; - lockSoftware = lockSoftware || std::ranges::any_of(g_pCompositor->m_vMonitors, [](const auto& m) { return m->activelyTearing; }); if (lockSoftware) { wlr_output_lock_software_cursors(pMonitor->output, true);