renderer/layer-shell: use explicitly set exclusiveEdge (#6984)

This commit is contained in:
Sam Lakerveld 2024-07-22 23:36:58 +02:00 committed by GitHub
parent 7c68236a51
commit 3c758db95c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -152,6 +152,8 @@ CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, SP<C
}); });
resource->setSetExclusiveEdge([this](CZwlrLayerSurfaceV1* r, zwlrLayerSurfaceV1Anchor anchor) { resource->setSetExclusiveEdge([this](CZwlrLayerSurfaceV1* r, zwlrLayerSurfaceV1Anchor anchor) {
// TODO: validate anchor
pending.committed |= STATE_EDGE; pending.committed |= STATE_EDGE;
pending.exclusiveEdge = anchor; pending.exclusiveEdge = anchor;
}); });

View file

@ -1506,7 +1506,8 @@ void CHyprRenderer::setSurfaceScanoutMode(SP<CWLSurfaceResource> surface, SP<CMo
// taken from Sway. // taken from Sway.
// this is just too much of a spaghetti for me to understand // this is just too much of a spaghetti for me to understand
static void applyExclusive(CBox& usableArea, uint32_t anchor, int32_t exclusive, int32_t marginTop, int32_t marginRight, int32_t marginBottom, int32_t marginLeft) { static void applyExclusive(CBox& usableArea, uint32_t anchor, int32_t exclusive, uint32_t exclusiveEdge, int32_t marginTop, int32_t marginRight, int32_t marginBottom,
int32_t marginLeft) {
if (exclusive <= 0) { if (exclusive <= 0) {
return; return;
} }
@ -1551,7 +1552,7 @@ static void applyExclusive(CBox& usableArea, uint32_t anchor, int32_t exclusive,
}, },
}; };
for (size_t i = 0; i < sizeof(edges) / sizeof(edges[0]); ++i) { for (size_t i = 0; i < sizeof(edges) / sizeof(edges[0]); ++i) {
if ((anchor == edges[i].singular_anchor || anchor == edges[i].anchor_triplet) && exclusive + edges[i].margin > 0) { if ((exclusiveEdge == edges[i].singular_anchor || anchor == edges[i].singular_anchor || anchor == edges[i].anchor_triplet) && exclusive + edges[i].margin > 0) {
if (edges[i].positive_axis) { if (edges[i].positive_axis) {
*edges[i].positive_axis += exclusive + edges[i].margin; *edges[i].positive_axis += exclusive + edges[i].margin;
} }
@ -1638,7 +1639,7 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<PHLL
// Apply // Apply
ls->geometry = box; ls->geometry = box;
applyExclusive(*usableArea, PSTATE->anchor, PSTATE->exclusive, PSTATE->margin.top, PSTATE->margin.right, PSTATE->margin.bottom, PSTATE->margin.left); applyExclusive(*usableArea, PSTATE->anchor, PSTATE->exclusive, PSTATE->exclusiveEdge, PSTATE->margin.top, PSTATE->margin.right, PSTATE->margin.bottom, PSTATE->margin.left);
if (Vector2D{box.width, box.height} != OLDSIZE) if (Vector2D{box.width, box.height} != OLDSIZE)
ls->layerSurface->configure(box.size()); ls->layerSurface->configure(box.size());