Skip to content

Commit

Permalink
fak
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Dec 9, 2024
1 parent 788c94a commit a58697d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
46 changes: 29 additions & 17 deletions src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe

renderdata.surfaceCounter = 0;
pWindow->m_pWLSurface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
renderdata.texture = s->current.texture;
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> 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<CTexPassElement>(renderdata));
renderdata.surfaceCounter++;
},
Expand Down Expand Up @@ -611,8 +613,10 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe

popup->m_pWLSurface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> 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<CTexPassElement>(renderdata));
renderdata.surfaceCounter++;
},
Expand Down Expand Up @@ -681,9 +685,11 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, timespec* tim

if (!popups)
pLayer->surface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
renderdata.texture = s->current.texture;
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> 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<CTexPassElement>(renderdata));
renderdata.surfaceCounter++;
},
Expand All @@ -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<CTexPassElement>(renderdata));
renderdata.surfaceCounter++;
},
Expand Down Expand Up @@ -733,9 +741,11 @@ void CHyprRenderer::renderIMEPopup(CInputPopup* pPopup, PHLMONITOR pMonitor, tim
}

SURF->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
renderdata.texture = s->current.texture;
[this, &renderdata, &SURF](SP<CWLSurfaceResource> 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<CTexPassElement>(renderdata));
renderdata.surfaceCounter++;
},
Expand All @@ -752,9 +762,11 @@ void CHyprRenderer::renderSessionLockSurface(SSessionLockSurface* pSurface, PHLM
renderdata.h = pMonitor->vecSize.y;

renderdata.surface->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
renderdata.texture = s->current.texture;
[this, &renderdata, &pSurface](SP<CWLSurfaceResource> 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<CTexPassElement>(renderdata));
renderdata.surfaceCounter++;
},
Expand Down
2 changes: 1 addition & 1 deletion src/render/pass/TexPassElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/render/pass/TexPassElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CTexPassElement : public IPassElement {
void* data = nullptr;
SP<CWLSurfaceResource> surface = nullptr;
SP<CTexture> texture = nullptr;
bool mainSurface = false;
bool mainSurface = true;
double w = 0, h = 0;

// for rounding
Expand Down

0 comments on commit a58697d

Please sign in to comment.