tree: make surface visibility tracking more robust
This commit is contained in:
parent
be0935c8dd
commit
ba98103233
26 changed files with 313 additions and 144 deletions
|
|
@ -46,6 +46,7 @@ pub struct WlSubsurface {
|
|||
latest_node: CloneCell<Option<NodeRef<StackElement>>>,
|
||||
depth: NumCell<u32>,
|
||||
pub tracker: Tracker<Self>,
|
||||
had_buffer: Cell<bool>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -102,6 +103,7 @@ impl WlSubsurface {
|
|||
latest_node: Default::default(),
|
||||
depth: NumCell::new(0),
|
||||
tracker: Default::default(),
|
||||
had_buffer: Cell::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,6 +180,7 @@ impl WlSubsurface {
|
|||
}
|
||||
}
|
||||
self.surface.client.remove_obj(self)?;
|
||||
self.surface.destroy_node();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -344,6 +347,16 @@ impl SurfaceExt for WlSubsurface {
|
|||
self.parent.need_extents_update.set(true);
|
||||
}
|
||||
}
|
||||
let has_buffer = self.surface.buffer.is_some();
|
||||
if self.had_buffer.replace(has_buffer) != has_buffer {
|
||||
if has_buffer {
|
||||
if self.parent.visible.get() {
|
||||
self.surface.set_visible(true);
|
||||
}
|
||||
} else {
|
||||
self.surface.destroy_node();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn subsurface_parent(&self) -> Option<Rc<WlSurface>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue