surface: fix subsurface property propagation
This commit is contained in:
parent
d273c97eb3
commit
c542d6188e
1 changed files with 12 additions and 26 deletions
|
|
@ -76,21 +76,16 @@ impl PendingSubsurfaceData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_children_attach(
|
fn update_children_attach(surface: &WlSubsurface) -> Result<(), WlSubsurfaceError> {
|
||||||
surface: &WlSubsurface,
|
if surface.depth.get() > MAX_SUBSURFACE_DEPTH {
|
||||||
mut sync: bool,
|
return Err(WlSubsurfaceError::MaxDepthExceeded);
|
||||||
depth: u32,
|
}
|
||||||
) -> Result<(), WlSubsurfaceError> {
|
|
||||||
let children = surface.surface.children.borrow();
|
let children = surface.surface.children.borrow();
|
||||||
if let Some(children) = &*children {
|
if let Some(children) = &*children {
|
||||||
for child in children.subsurfaces.values() {
|
for child in children.subsurfaces.values() {
|
||||||
child.depth.set(depth + 1);
|
child.sync_ancestor.set(surface.sync());
|
||||||
if depth + 1 > MAX_SUBSURFACE_DEPTH {
|
child.depth.set(surface.depth.get() + 1);
|
||||||
return Err(WlSubsurfaceError::MaxDepthExceeded);
|
update_children_attach(child)?;
|
||||||
}
|
|
||||||
child.sync_ancestor.set(sync);
|
|
||||||
sync |= child.sync_requested.get();
|
|
||||||
update_children_attach(child, sync, depth + 1)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -108,7 +103,7 @@ impl WlSubsurface {
|
||||||
sync_ancestor: Cell::new(false),
|
sync_ancestor: Cell::new(false),
|
||||||
node: RefCell::new(None),
|
node: RefCell::new(None),
|
||||||
latest_node: Default::default(),
|
latest_node: Default::default(),
|
||||||
depth: NumCell::new(0),
|
depth: NumCell::new(1),
|
||||||
tracker: Default::default(),
|
tracker: Default::default(),
|
||||||
had_buffer: Cell::new(false),
|
had_buffer: Cell::new(false),
|
||||||
}
|
}
|
||||||
|
|
@ -154,16 +149,9 @@ impl WlSubsurface {
|
||||||
if self.surface.id == self.parent.get_root().id {
|
if self.surface.id == self.parent.get_root().id {
|
||||||
return Err(WlSubsurfaceError::Ancestor(self.surface.id, self.parent.id));
|
return Err(WlSubsurfaceError::Ancestor(self.surface.id, self.parent.id));
|
||||||
}
|
}
|
||||||
let mut sync_ancestor = false;
|
if let Some(ss) = self.parent.ext.get().into_subsurface() {
|
||||||
let mut depth = 1;
|
self.sync_ancestor.set(ss.sync());
|
||||||
{
|
self.depth.set(ss.depth.get() + 1);
|
||||||
if let Some(ss) = self.parent.ext.get().into_subsurface() {
|
|
||||||
sync_ancestor = ss.sync();
|
|
||||||
depth = ss.depth.get() + 1;
|
|
||||||
if depth >= MAX_SUBSURFACE_DEPTH {
|
|
||||||
return Err(WlSubsurfaceError::MaxDepthExceeded);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let node = {
|
let node = {
|
||||||
let mut data = self.parent.children.borrow_mut();
|
let mut data = self.parent.children.borrow_mut();
|
||||||
|
|
@ -177,10 +165,8 @@ impl WlSubsurface {
|
||||||
self.latest_node.set(Some(node.to_ref()));
|
self.latest_node.set(Some(node.to_ref()));
|
||||||
self.pending().node = Some(node);
|
self.pending().node = Some(node);
|
||||||
self.surface.set_toplevel(self.parent.toplevel.get());
|
self.surface.set_toplevel(self.parent.toplevel.get());
|
||||||
self.sync_ancestor.set(sync_ancestor);
|
|
||||||
self.depth.set(depth);
|
|
||||||
self.surface.ext.set(self.clone());
|
self.surface.ext.set(self.clone());
|
||||||
update_children_attach(self, sync_ancestor, depth)?;
|
update_children_attach(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue