Skip to content

wayland/layer: Exclusive edge fix, protocol version 5, arrange order#1819

Merged
Drakulix merged 3 commits into
Smithay:masterfrom
ids1024:layer-shell-arrange
Oct 30, 2025
Merged

wayland/layer: Exclusive edge fix, protocol version 5, arrange order#1819
Drakulix merged 3 commits into
Smithay:masterfrom
ids1024:layer-shell-arrange

Conversation

@ids1024

@ids1024 ids1024 commented Sep 9, 2025

Copy link
Copy Markdown
Member

Iterate over surfaces that have an exclusive zone first, then other surfaces. This allows a surface that doesn't have an exclusive zone to be moved or resized for a later surface that does have an exclusive zone. As is probably desired.

This does help with a test client, but not with the client I was trying to fix; so I need to do a bit more testing here...

Comment thread src/desktop/wayland/layer.rs Outdated
@ids1024

ids1024 commented Oct 8, 2025

Copy link
Copy Markdown
Member Author

Looks like the handling of the edge for exclusive zones there isn't quite right already.

                      x if x.contains(Anchor::TOP) && x.contains(Anchor::BOTTOM) => {
                            zone.size.w -= amount;
                            if x.contains(Anchor::LEFT) {
                                zone.loc.x += amount;
                                zone.loc.x += data.margin.left;
                                zone.size.w -= data.margin.left;
                            }
                            if x.contains(Anchor::RIGHT) {
                                zone.size.w -= data.margin.right
                            }
                        }

This case appears before the x == Anchor::all() case; so presumably this branch would be hit, and the Anchor::Left case inside it instead.

We could have a function to determine the exclusive edge, if any. And also add support for version 5 of the protocol supporting an explicit exclusive edge: https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/merge_requests/123

@ids1024
ids1024 force-pushed the layer-shell-arrange branch from 9668eae to 3290055 Compare October 9, 2025 02:00
@ids1024 ids1024 changed the title wayland/layer: In arrange(), handle exclusive zone surfaces first wayland/layer: Exclusive edge fix, protocol version 5, arrange order Oct 9, 2025
This simplifies the match for anchors, and should correct the behavior
for things like anchoring all edges.

I believe previously the `x == Anchor::all()` case would never be
reached, since the `x.contains(Anchor::TOP) && x.contains(Anchor::BOTTOM)`
condition would also be true. Also the behavior is wrong; the spec says
to treat this like `ExclusiveZone::Neutral`.

This should now behave as defined by the spec.
Use the exclusive edge provided by the request if present. Otherwise,
fallback to the implied edge based on anchors.
Iterate over surfaces that have an exclusive zone first, then other
surfaces. This allows a surface that doesn't have an exclusive zone to
be moved or resized for a later surface that does have an exclusive
zone. As is probably desired.
@ids1024
ids1024 force-pushed the layer-shell-arrange branch from 3290055 to 82f830d Compare October 30, 2025 02:41
@ids1024
ids1024 marked this pull request as ready for review October 30, 2025 16:09
@ids1024

ids1024 commented Oct 30, 2025

Copy link
Copy Markdown
Member Author

The arrange fix can be opening a layer surface without an exclusive zone, then opening one with an exclusive zone. For instance on COMSIC, sleep 5 && cosmic-panel, then opening the workspaces view.

Before this change, the workspaces view didn't resize to make space for the panel. After this change, it does.

@Drakulix Drakulix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me

@Drakulix
Drakulix merged commit 55186e1 into Smithay:master Oct 30, 2025
13 checks passed
Comment on lines +460 to +462
_ => unreachable!(),
}),
_ => unreachable!(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this value guaranteed to be valid, or parsed from the client unchecked? If the former, perhaps add a comment here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this part again, I guess we want another check here, if the client tried to set multiple edges for the exclusive edge: #1849

ids1024 added a commit to pop-os/cosmic-comp that referenced this pull request Oct 31, 2025
Updates for `last_acked`, etc. API changes in
Smithay/smithay#1817.

Includes layer shell fixes
from Smithay/smithay#1819.
ids1024 added a commit to pop-os/cosmic-comp that referenced this pull request Nov 7, 2025
Updates for `last_acked`, etc. API changes in
Smithay/smithay#1817.

Includes layer shell fixes
from Smithay/smithay#1819.
Drakulix pushed a commit to pop-os/cosmic-comp that referenced this pull request Nov 11, 2025
Updates for `last_acked`, etc. API changes in
Smithay/smithay#1817.

Includes layer shell fixes
from Smithay/smithay#1819.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants