squish oversized subsurfaces while animating

This commit is contained in:
vaxerski 2022-07-11 23:38:10 +02:00
parent 668dc9bd9c
commit f461ea3105
2 changed files with 14 additions and 1 deletions

View file

@ -67,6 +67,9 @@ struct SRenderData {
// for blurring // for blurring
bool blur = false; bool blur = false;
// for windows that animate poorly
bool squishOversized = false;
}; };
struct SStringRuleNames { struct SStringRuleNames {

View file

@ -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}; 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 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)}; 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); scaleBox(&windowBox, RDATA->output->scale);
static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; 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.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.rounding = pWindow->m_sAdditionalConfigData.rounding;
renderdata.blur = true; // if it shouldn't, it will be ignored later renderdata.blur = true; // if it shouldn't, it will be ignored later
renderdata.squishOversized = pWindow->m_vRealPosition.isBeingAnimated();
// apply window special data // apply window special data
if (pWindow->m_sSpecialRenderData.alphaInactive == -1) if (pWindow->m_sSpecialRenderData.alphaInactive == -1)