diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-07-11 23:38:10 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-07-11 23:38:10 +0200 |
| commit | f461ea3105fbe7979a44d702bd9b2f7ee46a9441 (patch) | |
| tree | 2c1bd3bf98aa41fc39700b3033e85f5a19a381a4 | |
| parent | 668dc9bd9c530757d8bcb308ecdc76bf4f705a88 (diff) | |
squish oversized subsurfaces while animating
| -rw-r--r-- | src/helpers/WLClasses.hpp | 3 | ||||
| -rw-r--r-- | src/render/Renderer.cpp | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp index 962c27b0..ed10b2fc 100644 --- a/src/helpers/WLClasses.hpp +++ b/src/helpers/WLClasses.hpp @@ -67,6 +67,9 @@ struct SRenderData { // for blurring bool blur = false; + + // for windows that animate poorly + bool squishOversized = false; }; struct SStringRuleNames { diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index bc0fee90..be36509b 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -16,6 +16,15 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) { windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, RDATA->w, RDATA->h}; else // here we clamp to 2, these might be some tiny specks windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, std::clamp(surface->current.width, 2, 1337420), std::clamp(surface->current.height, 2, 1337420)}; + + // squish all oversized + if (RDATA->squishOversized) { + if (x + windowBox.width > RDATA->w) + windowBox.width = RDATA->w - x; + if (y + windowBox.height > RDATA->h) + windowBox.height = RDATA->h - y; + } + scaleBox(&windowBox, RDATA->output->scale); static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; @@ -173,6 +182,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec* renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && (pWindow->m_bIsFloating ? *PNOFLOATINGBORDERS == 0 : true) && (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL); renderdata.rounding = pWindow->m_sAdditionalConfigData.rounding; renderdata.blur = true; // if it shouldn't, it will be ignored later + renderdata.squishOversized = pWindow->m_vRealPosition.isBeingAnimated(); // apply window special data if (pWindow->m_sSpecialRenderData.alphaInactive == -1) @@ -817,4 +827,4 @@ void CHyprRenderer::ensureCursorRenderingMode() { bool CHyprRenderer::shouldRenderCursor() { return m_bHasARenderedCursor; -}
\ No newline at end of file +} |
