summaryrefslogtreecommitdiff
path: root/src/render/Renderer.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-10-20 20:32:47 +0100
committerVaxry <vaxry@vaxry.net>2023-10-20 20:32:47 +0100
commit4a79718fe8e4601983797d254cce39960827cb02 (patch)
tree07a6c635f369687d773215de9d5d16ccc1548faf /src/render/Renderer.cpp
parent7f35f33b4ca16509e127976772db6abd9abf100b (diff)
renderer: fix shimmers when manual resizing
Diffstat (limited to 'src/render/Renderer.cpp')
-rw-r--r--src/render/Renderer.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 7fe2774b..c153b855 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -30,13 +30,19 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
auto* const PSURFACE = CWLSurface::surfaceFromWlr(surface);
if (PSURFACE && !PSURFACE->m_bFillIgnoreSmall && PSURFACE->small() /* guarantees m_pOwner */) {
- const auto CORRECT = PSURFACE->correctSmallVec();
+ const auto CORRECT = PSURFACE->correctSmallVec();
+ const auto INTERACTIVERESIZEINPROGRESS = g_pInputManager->currentlyDraggedWindow == PSURFACE->m_pOwner && g_pInputManager->dragMode == MBIND_RESIZE;
- windowBox.x += CORRECT.x;
- windowBox.y += CORRECT.y;
+ if (!INTERACTIVERESIZEINPROGRESS) {
+ windowBox.x += CORRECT.x;
+ windowBox.y += CORRECT.y;
- windowBox.width = (double)surface->current.buffer_width * (PSURFACE->m_pOwner->m_vRealSize.vec().x / PSURFACE->m_pOwner->m_vReportedSize.x);
- windowBox.height = (double)surface->current.buffer_height * (PSURFACE->m_pOwner->m_vRealSize.vec().y / PSURFACE->m_pOwner->m_vReportedSize.y);
+ windowBox.width = (double)surface->current.buffer_width * (PSURFACE->m_pOwner->m_vRealSize.vec().x / PSURFACE->m_pOwner->m_vReportedSize.x);
+ windowBox.height = (double)surface->current.buffer_height * (PSURFACE->m_pOwner->m_vRealSize.vec().y / PSURFACE->m_pOwner->m_vReportedSize.y);
+ } else {
+ windowBox.width = (double)surface->current.buffer_width;
+ windowBox.height = (double)surface->current.buffer_height;
+ }
}
} else { // here we clamp to 2, these might be some tiny specks
@@ -682,7 +688,7 @@ void CHyprRenderer::calculateUVForSurface(CWindow* pWindow, wlr_surface* pSurfac
wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, &geom);
// ignore X and Y, adjust uv
- if (geom.x != 0 || geom.y != 0 || geom.width > pWindow->m_vRealSize.goalv().x || geom.height > pWindow->m_vRealSize.goalv().y) {
+ if (geom.x != 0 || geom.y != 0 || geom.width > pWindow->m_vRealSize.vec().x || geom.height > pWindow->m_vRealSize.vec().y) {
const auto XPERC = (double)geom.x / (double)pSurface->current.width;
const auto YPERC = (double)geom.y / (double)pSurface->current.height;
const auto WPERC = (double)(geom.x + geom.width) / (double)pSurface->current.width;
@@ -692,9 +698,9 @@ void CHyprRenderer::calculateUVForSurface(CWindow* pWindow, wlr_surface* pSurfac
uvBR = uvBR - Vector2D(1.0 - WPERC * (uvBR.x - uvTL.x), 1.0 - HPERC * (uvBR.y - uvTL.y));
uvTL = uvTL + TOADDTL;
- if (geom.width > pWindow->m_vRealSize.goalv().x || geom.height > pWindow->m_vRealSize.goalv().y) {
- uvBR.x = uvBR.x * (pWindow->m_vRealSize.goalv().x / geom.width);
- uvBR.y = uvBR.y * (pWindow->m_vRealSize.goalv().y / geom.height);
+ if (geom.width > pWindow->m_vRealSize.vec().x || geom.height > pWindow->m_vRealSize.vec().y) {
+ uvBR.x = uvBR.x * (pWindow->m_vRealSize.vec().x / geom.width);
+ uvBR.y = uvBR.y * (pWindow->m_vRealSize.vec().y / geom.height);
}
}