diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 1f3b9c26a6d..74233ecf0e0 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -544,9 +544,11 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe renderdata.surfaceCounter = 0; pWindow->m_pWLSurface->resource()->breadthfirst( - [this, &renderdata](SP s, const Vector2D& offset, void* data) { - renderdata.localPos = offset; - renderdata.texture = s->current.texture; + [this, &renderdata, &pWindow](SP s, const Vector2D& offset, void* data) { + renderdata.localPos = offset; + renderdata.texture = s->current.texture; + renderdata.surface = s; + renderdata.mainSurface = s == pWindow->m_pWLSurface->resource(); m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, @@ -611,8 +613,10 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe popup->m_pWLSurface->resource()->breadthfirst( [this, &renderdata](SP s, const Vector2D& offset, void* data) { - renderdata.localPos = offset; - renderdata.texture = s->current.texture; + renderdata.localPos = offset; + renderdata.texture = s->current.texture; + renderdata.surface = s; + renderdata.mainSurface = false; m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, @@ -681,9 +685,11 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, timespec* tim if (!popups) pLayer->surface->resource()->breadthfirst( - [this, &renderdata](SP s, const Vector2D& offset, void* data) { - renderdata.localPos = offset; - renderdata.texture = s->current.texture; + [this, &renderdata, &pLayer](SP s, const Vector2D& offset, void* data) { + renderdata.localPos = offset; + renderdata.texture = s->current.texture; + renderdata.surface = s; + renderdata.mainSurface = s == pLayer->surface->resource(); m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, @@ -700,9 +706,11 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, timespec* tim if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource() || !popup->m_bMapped) return; - Vector2D pos = popup->coordsRelativeToParent(); - renderdata.localPos = pos; - renderdata.texture = popup->m_pWLSurface->resource()->current.texture; + Vector2D pos = popup->coordsRelativeToParent(); + renderdata.localPos = pos; + renderdata.texture = popup->m_pWLSurface->resource()->current.texture; + renderdata.surface = popup->m_pWLSurface->resource(); + renderdata.mainSurface = false; m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, @@ -733,9 +741,11 @@ void CHyprRenderer::renderIMEPopup(CInputPopup* pPopup, PHLMONITOR pMonitor, tim } SURF->breadthfirst( - [this, &renderdata](SP s, const Vector2D& offset, void* data) { - renderdata.localPos = offset; - renderdata.texture = s->current.texture; + [this, &renderdata, &SURF](SP s, const Vector2D& offset, void* data) { + renderdata.localPos = offset; + renderdata.texture = s->current.texture; + renderdata.surface = s; + renderdata.mainSurface = s == SURF; m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, @@ -752,9 +762,11 @@ void CHyprRenderer::renderSessionLockSurface(SSessionLockSurface* pSurface, PHLM renderdata.h = pMonitor->vecSize.y; renderdata.surface->breadthfirst( - [this, &renderdata](SP s, const Vector2D& offset, void* data) { - renderdata.localPos = offset; - renderdata.texture = s->current.texture; + [this, &renderdata, &pSurface](SP s, const Vector2D& offset, void* data) { + renderdata.localPos = offset; + renderdata.texture = s->current.texture; + renderdata.surface = s; + renderdata.mainSurface = s == pSurface->surface->surface(); m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, diff --git a/src/render/pass/TexPassElement.cpp b/src/render/pass/TexPassElement.cpp index 18e0b1ac53d..60df0022cb5 100644 --- a/src/render/pass/TexPassElement.cpp +++ b/src/render/pass/TexPassElement.cpp @@ -73,7 +73,7 @@ void CTexPassElement::draw(const CRegion& damage) { const bool BLUR = data.blur && (!TEXTURE->m_bOpaque || ALPHA < 1.F); CBox windowBox; - if (data.surface && data.surface == data.surface) { + if (data.surface && data.mainSurface) { windowBox = {(int)outputX + data.pos.x + data.localPos.x, (int)outputY + data.pos.y + data.localPos.y, data.w, data.h}; // however, if surface buffer w / h < box, we need to adjust them diff --git a/src/render/pass/TexPassElement.hpp b/src/render/pass/TexPassElement.hpp index 4c2dd743aa4..32ee22ea51a 100644 --- a/src/render/pass/TexPassElement.hpp +++ b/src/render/pass/TexPassElement.hpp @@ -16,7 +16,7 @@ class CTexPassElement : public IPassElement { void* data = nullptr; SP surface = nullptr; SP texture = nullptr; - bool mainSurface = false; + bool mainSurface = true; double w = 0, h = 0; // for rounding