mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:05:59 +01:00
renderer: fix shimmers when manual resizing
This commit is contained in:
parent
7f35f33b4c
commit
4a79718fe8
1 changed files with 15 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue