aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-03-15 19:23:45 +0000
committerVaxry <[email protected]>2024-03-15 19:23:51 +0000
commit38576d651a9a7edcf5d7b782a2f415c8a1f0f4e6 (patch)
tree02430249ddd817bf95af9ca5617582353445151c
parent72d78eff95948a3eb3260791cfdf625c0102d33a (diff)
downloadHyprland-38576d651a9a7edcf5d7b782a2f415c8a1f0f4e6.tar.gz
Hyprland-38576d651a9a7edcf5d7b782a2f415c8a1f0f4e6.zip
renderer: adjust surface dimensions for oversized not-yet ackd surface sizes
supersedes #5104
-rw-r--r--src/render/Renderer.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 815b70fb..2a0c6f7d 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -75,23 +75,34 @@ static void renderSurface(struct wlr_surface* surface, int x, int y, void* data)
// however, if surface buffer w / h < box, we need to adjust them
auto* const PSURFACE = CWLSurface::surfaceFromWlr(surface);
+ const auto PWINDOW = PSURFACE->getWindow();
- if (PSURFACE && !PSURFACE->m_bFillIgnoreSmall && PSURFACE->small() /* guarantees m_pWindowOwner */) {
+ if (PSURFACE && !PSURFACE->m_bFillIgnoreSmall && PSURFACE->small() /* guarantees PWINDOW */) {
const auto CORRECT = PSURFACE->correctSmallVec();
const auto SIZE = PSURFACE->getViewporterCorrectedSize();
if (!INTERACTIVERESIZEINPROGRESS) {
- windowBox.x += CORRECT.x;
- windowBox.y += CORRECT.y;
+ windowBox.translate(CORRECT);
- windowBox.width = SIZE.x * (PSURFACE->getWindow()->m_vRealSize.value().x / PSURFACE->getWindow()->m_vReportedSize.x);
- windowBox.height = SIZE.y * (PSURFACE->getWindow()->m_vRealSize.value().y / PSURFACE->getWindow()->m_vReportedSize.y);
+ windowBox.width = SIZE.x * (PWINDOW->m_vRealSize.value().x / PWINDOW->m_vReportedSize.x);
+ windowBox.height = SIZE.y * (PWINDOW->m_vRealSize.value().y / PWINDOW->m_vReportedSize.y);
} else {
windowBox.width = SIZE.x;
windowBox.height = SIZE.y;
}
}
+ if (PSURFACE && PWINDOW && PWINDOW->m_vRealSize.goal() > PWINDOW->m_vReportedSize) {
+ Vector2D size =
+ Vector2D{windowBox.w * (PWINDOW->m_vReportedSize.x / PWINDOW->m_vRealSize.value().x), windowBox.h * (PWINDOW->m_vReportedSize.y / PWINDOW->m_vRealSize.value().y)};
+ Vector2D correct = Vector2D{windowBox.w, windowBox.h} - size;
+
+ windowBox.translate(correct / 2.0);
+
+ windowBox.w = size.x;
+ windowBox.h = size.y;
+ }
+
} else { // here we clamp to 2, these might be some tiny specks
windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, std::max(surface->current.width, 2), std::max(surface->current.height, 2)};
if (RDATA->pWindow && RDATA->pWindow->m_vRealSize.isBeingAnimated() && RDATA->surface && RDATA->surface != surface && RDATA->squishOversized /* subsurface */) {