Skip to content

Commit 223ac50

Browse files
committed
wayland/layer: In arrange(), handle exclusive zone surfaces first
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.
1 parent 9ccbd35 commit 223ac50

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/desktop/wayland/layer.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,15 @@ impl LayerMap {
272272
);
273273
trace!("Arranging layers into {:?}", output_rect.size);
274274

275-
for layer in self.layers.iter() {
275+
let exclusive_surfaces = self
276+
.layers
277+
.iter()
278+
.filter(|l| matches!(l.exclusive_zone(), ExclusiveZone::Exclusive(_)));
279+
let non_exclusive_surfaces = self
280+
.layers
281+
.iter()
282+
.filter(|l| !matches!(l.exclusive_zone(), ExclusiveZone::Exclusive(_)));
283+
for layer in exclusive_surfaces.chain(non_exclusive_surfaces) {
276284
let surface = layer.wl_surface();
277285

278286
with_surface_tree_downward(
@@ -718,6 +726,16 @@ impl LayerSurface {
718726
pub fn user_data(&self) -> &UserDataMap {
719727
&self.0.userdata
720728
}
729+
730+
fn exclusive_zone(&self) -> ExclusiveZone {
731+
with_states(self.wl_surface(), |states| {
732+
states
733+
.cached_state
734+
.get::<LayerSurfaceCachedState>()
735+
.current()
736+
.exclusive_zone
737+
})
738+
}
721739
}
722740

723741
impl WaylandFocus for LayerSurface {

0 commit comments

Comments
 (0)