decoration: take desiredExtents on all sides into account (#12935)

This commit is contained in:
zacoons 2026-01-11 05:53:57 +10:00 committed by GitHub
parent 81e7498ec2
commit 8f8b31e7a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -214,29 +214,23 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
continue; continue;
} }
auto desiredSize = 0; const auto desiredExtents = wd->positioningInfo.desiredExtents;
if (LEFT)
desiredSize = wd->positioningInfo.desiredExtents.topLeft.x;
else if (RIGHT)
desiredSize = wd->positioningInfo.desiredExtents.bottomRight.x;
else if (TOP)
desiredSize = wd->positioningInfo.desiredExtents.topLeft.y;
else
desiredSize = wd->positioningInfo.desiredExtents.bottomRight.y;
const auto EDGEPOINT = getEdgeDefinedPoint(wd->positioningInfo.edges, pWindow); const auto EDGEPOINT = getEdgeDefinedPoint(wd->positioningInfo.edges, pWindow);
Vector2D pos, size; Vector2D pos, size;
if (EDGESNO == 4) { if (EDGESNO == 4) {
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL + desiredSize, stickyOffsetYT + desiredSize}; stickyOffsetXL += desiredExtents.topLeft.x;
size = wb.size() + Vector2D{stickyOffsetXL + stickyOffsetXR + desiredSize * 2, stickyOffsetYB + stickyOffsetYT + desiredSize * 2}; stickyOffsetXR += desiredExtents.bottomRight.x;
stickyOffsetYT += desiredExtents.topLeft.y;
stickyOffsetYB += desiredExtents.bottomRight.y;
stickyOffsetXL += desiredSize; pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYT};
stickyOffsetXR += desiredSize; size = wb.size() + Vector2D{stickyOffsetXL + stickyOffsetXR, stickyOffsetYB + stickyOffsetYT};
stickyOffsetYT += desiredSize;
stickyOffsetYB += desiredSize;
} else if (LEFT) { } else if (LEFT) {
const auto desiredSize = desiredExtents.topLeft.x;
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, -stickyOffsetYT}; pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, -stickyOffsetYT};
pos.x -= desiredSize; pos.x -= desiredSize;
size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT}; size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT};
@ -244,12 +238,16 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
if (SOLID) if (SOLID)
stickyOffsetXL += desiredSize; stickyOffsetXL += desiredSize;
} else if (RIGHT) { } else if (RIGHT) {
const auto desiredSize = desiredExtents.bottomRight.x;
pos = wb.pos() + Vector2D{wb.size().x, 0.0} - EDGEPOINT + Vector2D{stickyOffsetXR, -stickyOffsetYT}; pos = wb.pos() + Vector2D{wb.size().x, 0.0} - EDGEPOINT + Vector2D{stickyOffsetXR, -stickyOffsetYT};
size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT}; size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT};
if (SOLID) if (SOLID)
stickyOffsetXR += desiredSize; stickyOffsetXR += desiredSize;
} else if (TOP) { } else if (TOP) {
const auto desiredSize = desiredExtents.topLeft.y;
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYT}; pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYT};
pos.y -= desiredSize; pos.y -= desiredSize;
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)}; size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)};
@ -257,6 +255,8 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
if (SOLID) if (SOLID)
stickyOffsetYT += desiredSize; stickyOffsetYT += desiredSize;
} else { } else {
const auto desiredSize = desiredExtents.bottomRight.y;
pos = wb.pos() + Vector2D{0.0, wb.size().y} - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYB}; pos = wb.pos() + Vector2D{0.0, wb.size().y} - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYB};
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)}; size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)};