mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 21:25:58 +01:00
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
This commit is contained in:
parent
077494ee85
commit
a5f58a3126
2 changed files with 11 additions and 3 deletions
|
@ -11,7 +11,7 @@ void CLayerShellResource::SState::reset() {
|
||||||
exclusive = 0;
|
exclusive = 0;
|
||||||
interactivity = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
interactivity = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||||
layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
|
layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
|
||||||
exclusiveEdge = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;
|
exclusiveEdge = (zwlrLayerSurfaceV1Anchor)0;
|
||||||
desiredSize = {};
|
desiredSize = {};
|
||||||
margin = {0, 0, 0, 0};
|
margin = {0, 0, 0, 0};
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,15 @@ CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, SP<C
|
||||||
});
|
});
|
||||||
|
|
||||||
resource->setSetExclusiveEdge([this](CZwlrLayerSurfaceV1* r, zwlrLayerSurfaceV1Anchor anchor) {
|
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.committed |= STATE_EDGE;
|
||||||
pending.exclusiveEdge = anchor;
|
pending.exclusiveEdge = anchor;
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CLayerShellResource : public ISurfaceRole {
|
||||||
Vector2D desiredSize;
|
Vector2D desiredSize;
|
||||||
zwlrLayerSurfaceV1KeyboardInteractivity interactivity = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
zwlrLayerSurfaceV1KeyboardInteractivity interactivity = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||||
zwlrLayerShellV1Layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
|
zwlrLayerShellV1Layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
|
||||||
zwlrLayerSurfaceV1Anchor exclusiveEdge = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;
|
zwlrLayerSurfaceV1Anchor exclusiveEdge = (zwlrLayerSurfaceV1Anchor)0;
|
||||||
uint32_t committed = 0;
|
uint32_t committed = 0;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
Loading…
Reference in a new issue