From e990630562e47ca75cfa7b909d274195392696c1 Mon Sep 17 00:00:00 2001 From: nyx Date: Fri, 21 Mar 2025 04:35:34 -0400 Subject: [PATCH] layerSurface: fix circle not following cursor movement (#113) * layerSurface: fix circle not following cursor movement * misc: format code --- src/helpers/LayerSurface.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/helpers/LayerSurface.cpp b/src/helpers/LayerSurface.cpp index da1fec5..ab7c7de 100644 --- a/src/helpers/LayerSurface.cpp +++ b/src/helpers/LayerSurface.cpp @@ -71,11 +71,12 @@ static void onCallbackDone(CLayerSurface* surf, uint32_t when) { } void CLayerSurface::sendFrame() { + lastBuffer = lastBuffer == 0 ? 1 : 0; + const auto& PBUFFER = buffers[lastBuffer]; + frameCallback = makeShared(pSurface->sendFrame()); frameCallback->setDone([this](CCWlCallback* r, uint32_t when) { onCallbackDone(this, when); }); - const auto& PBUFFER = lastBuffer == 0 ? buffers[0] : buffers[1]; - pSurface->sendAttach(PBUFFER->buffer.get(), 0, 0); if (!g_pHyprpicker->m_bNoFractional) { pSurface->sendSetBufferScale(1); @@ -83,7 +84,6 @@ void CLayerSurface::sendFrame() { } else pSurface->sendSetBufferScale(m_pMonitor->scale); - pSurface->sendDamageBuffer(0, 0, 0xFFFF, 0xFFFF); pSurface->sendCommit(); dirty = false; @@ -92,6 +92,12 @@ void CLayerSurface::sendFrame() { void CLayerSurface::markDirty() { frameCallback = makeShared(pSurface->sendFrame()); frameCallback->setDone([this](CCWlCallback* r, uint32_t when) { onCallbackDone(this, when); }); + + pSurface->sendDamageBuffer(0, 0, 0xFFFF, 0xFFFF); + + if (buffers[lastBuffer]) + pSurface->sendAttach(buffers[lastBuffer]->buffer.get(), 0, 0); + pSurface->sendCommit(); dirty = true;