From 16afa2c42200e7a7d8b45602f584986094c92721 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 16 Jul 2022 20:57:59 +0200 Subject: [PATCH] fix border rendering on certain windows oversized subsurfaces had a tendency to be above borders, now they wont be --- src/render/Renderer.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index e3e67a65..6823d5d3 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -40,12 +40,6 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) { g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding); else g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true); - - if (RDATA->decorate) { - auto col = g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColor.col(); - col.a *= RDATA->fadeAlpha * RDATA->alpha / 255.f; - g_pHyprOpenGL->renderBorder(&windowBox, col, rounding); - } } else { if (RDATA->surface && wlr_surface_is_xdg_surface(RDATA->surface)) { @@ -241,6 +235,19 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec* wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata); + if (renderdata.decorate) { + static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; + + float rounding = renderdata.dontRound ? 0 : renderdata.rounding == -1 ? *PROUNDING : renderdata.rounding; + + auto col = g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColor.col(); + col.a *= renderdata.fadeAlpha * renderdata.alpha / 255.f; + + wlr_box windowBox = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h}; + + g_pHyprOpenGL->renderBorder(&windowBox, col, rounding); + } + g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = Vector2D(-1, -1); g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight = Vector2D(-1, -1); }