diff options
author | vaxerski <[email protected]> | 2022-08-27 21:33:07 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-08-27 21:33:07 +0200 |
commit | c32acff8af154830fa5e448e722e5244ce713154 (patch) | |
tree | 75756470f083711ccaeb57f8026791451452ecfe | |
parent | 266935320df7191174b2a9b4f16a48607a523fd8 (diff) | |
download | Hyprland-c32acff8af154830fa5e448e722e5244ce713154.tar.gz Hyprland-c32acff8af154830fa5e448e722e5244ce713154.zip |
fix popups
-rw-r--r-- | src/render/Renderer.cpp | 15 | ||||
-rw-r--r-- | src/render/Renderer.hpp | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index ad3f56ef..cd81e19a 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -30,7 +30,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) { } if (RDATA->pWindow) - g_pHyprRenderer->calculateUVForWindowSurface(RDATA->pWindow, surface); + g_pHyprRenderer->calculateUVForWindowSurface(RDATA->pWindow, surface, RDATA->squishOversized); scaleBox(&windowBox, RDATA->output->scale); @@ -400,7 +400,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) { renderDragIcon(PMONITOR, time); } -void CHyprRenderer::calculateUVForWindowSurface(CWindow* pWindow, wlr_surface* pSurface) { +void CHyprRenderer::calculateUVForWindowSurface(CWindow* pWindow, wlr_surface* pSurface, bool main) { if (!pWindow->m_bIsX11) { Vector2D uvTL; Vector2D uvBR = Vector2D(1, 1); @@ -423,9 +423,11 @@ void CHyprRenderer::calculateUVForWindowSurface(CWindow* pWindow, wlr_surface* p adjustedSurfaceScale = Vector2D(bufferSource.width / surfaceSize.x, bufferSource.height / surfaceSize.y); // TODO: (example: chromium) this still has a tiny "bump" at the end. - uvTL = uvTL + (Vector2D((double)geom.x / ((double)pSurface->current.width), (double)geom.y / ((double)pSurface->current.height)) * (((uvBR.x - uvTL.x) * surfaceSize.x) / surfaceSize.x)); - uvBR = uvBR * Vector2D((double)(geom.width + geom.x) / ((double)pSurface->current.width), (double)(geom.y + geom.height) / ((double)pSurface->current.height)); - } else { + if (main) { + uvTL = uvTL + (Vector2D((double)geom.x / ((double)pSurface->current.width), (double)geom.y / ((double)pSurface->current.height)) * (((uvBR.x - uvTL.x) * surfaceSize.x) / surfaceSize.x)); + uvBR = uvBR * Vector2D((double)(geom.width + geom.x) / ((double)pSurface->current.width), (double)(geom.y + geom.height) / ((double)pSurface->current.height)); + } + } else if (main) { // oversized windows' UV adjusting uvTL = Vector2D((double)geom.x / ((double)pSurface->current.width), (double)geom.y / ((double)pSurface->current.height)); uvBR = Vector2D((double)(geom.width + geom.x) / ((double)pSurface->current.width), (double)(geom.y + geom.height) / ((double)pSurface->current.height)); @@ -441,6 +443,9 @@ void CHyprRenderer::calculateUVForWindowSurface(CWindow* pWindow, wlr_surface* p g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight = Vector2D(-1, -1); } + if (!main) + return; // ignore the rest + // then, if the surface is too big, modify the pos UV if (geom.width > pWindow->m_vRealSize.vec().x + 1 || geom.height > pWindow->m_vRealSize.vec().y + 1) { const auto OFF = Vector2D(pWindow->m_vRealSize.vec().x / (double)geom.width, pWindow->m_vRealSize.vec().y / (double)geom.height); diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index e35e6fc7..04b2bb45 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -40,7 +40,7 @@ public: bool shouldRenderWindow(CWindow*); void ensureCursorRenderingMode(); bool shouldRenderCursor(); - void calculateUVForWindowSurface(CWindow*, wlr_surface*); + void calculateUVForWindowSurface(CWindow*, wlr_surface*, bool main = false); bool m_bWindowRequestedCursorHide = false; |