diff options
| author | Ikalco <73481042+ikalco@users.noreply.github.com> | 2024-07-23 13:03:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-23 20:03:15 +0200 |
| commit | a5f58a31268da95e36c0918ac75589c05e81b892 (patch) | |
| tree | 48b655269d5a487ee51dd8d5df1724a4577609b9 /src/protocols/LayerShell.cpp | |
| parent | 077494ee85c8fa4c6ae74ad8d749feea826294d2 (diff) | |
layer-shell: validate exclusiveEdge and don't set it as top by default (#7006)
* validate exclusiveEdge and don't set it as top by default
* make sure exclusive edge anchor is within bounds
Diffstat (limited to 'src/protocols/LayerShell.cpp')
| -rw-r--r-- | src/protocols/LayerShell.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/protocols/LayerShell.cpp b/src/protocols/LayerShell.cpp index 029f261d..4e733b35 100644 --- a/src/protocols/LayerShell.cpp +++ b/src/protocols/LayerShell.cpp @@ -11,7 +11,7 @@ void CLayerShellResource::SState::reset() { exclusive = 0; interactivity = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE; layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; - exclusiveEdge = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP; + exclusiveEdge = (zwlrLayerSurfaceV1Anchor)0; desiredSize = {}; margin = {0, 0, 0, 0}; } @@ -152,7 +152,15 @@ CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, SP<C }); resource->setSetExclusiveEdge([this](CZwlrLayerSurfaceV1* r, zwlrLayerSurfaceV1Anchor anchor) { - // TODO: validate anchor + if (anchor > (ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) { + r->error(ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_EXCLUSIVE_EDGE, "Invalid exclusive edge"); + return; + } + + if (!pending.anchor || !(pending.anchor & anchor)) { + r->error(ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_EXCLUSIVE_EDGE, "Exclusive edge doesn't align with anchor"); + return; + } pending.committed |= STATE_EDGE; pending.exclusiveEdge = anchor; |
