1
0
Fork 0
forked from wry/wry

Merge pull request #548 from disluckyguy/update-on-pos-change

layershell: update tree on position change
This commit is contained in:
mahkoh 2025-07-27 21:12:29 +02:00 committed by GitHub
commit e67811565a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,6 +71,7 @@ pub struct ZwlrLayerSurfaceV1 {
exclusive_edge: Cell<Option<u32>>, exclusive_edge: Cell<Option<u32>>,
exclusive_size: Cell<ExclusiveSize>, exclusive_size: Cell<ExclusiveSize>,
popups: CopyHashMap<XdgPopupId, Rc<Popup>>, popups: CopyHashMap<XdgPopupId, Rc<Popup>>,
need_position_update: Cell<bool>,
} }
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
@ -177,6 +178,7 @@ impl ZwlrLayerSurfaceV1 {
exclusive_edge: Default::default(), exclusive_edge: Default::default(),
exclusive_size: Default::default(), exclusive_size: Default::default(),
popups: Default::default(), popups: Default::default(),
need_position_update: Default::default(),
} }
} }
@ -398,13 +400,19 @@ impl ZwlrLayerSurfaceV1 {
self.size.set(size); self.size.set(size);
} }
if let Some(anchor) = pending.anchor.take() { if let Some(anchor) = pending.anchor.take() {
self.anchor.set(anchor); if self.anchor.replace(anchor) != anchor {
self.need_position_update.set(true);
}
} }
if let Some(ez) = pending.exclusive_zone.take() { if let Some(ez) = pending.exclusive_zone.take() {
self.exclusive_zone.set(ez); if self.exclusive_zone.replace(ez) != ez {
self.need_position_update.set(true);
}
} }
if let Some(margin) = pending.margin.take() { if let Some(margin) = pending.margin.take() {
self.margin.set(margin); if self.margin.replace(margin) != margin {
self.need_position_update.set(true);
}
} }
if let Some(ki) = pending.keyboard_interactivity.take() { if let Some(ki) = pending.keyboard_interactivity.take() {
self.keyboard_interactivity.set(ki); self.keyboard_interactivity.set(ki);
@ -519,6 +527,7 @@ impl ZwlrLayerSurfaceV1 {
} }
} }
self.client.state.tree_changed(); self.client.state.tree_changed();
self.need_position_update.set(false);
} }
pub fn output_resized(&self) { pub fn output_resized(&self) {
@ -593,6 +602,9 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
self.destroy_node(); self.destroy_node();
} else { } else {
if self.surface.extents.get().size() != self.pos.get().size() { if self.surface.extents.get().size() != self.pos.get().size() {
self.need_position_update.set(true);
}
if self.need_position_update.get() {
self.compute_position(); self.compute_position();
} }
self.update_exclusive_size(); self.update_exclusive_size();