fix(winit): Cleanup surface_subsurfaces on parent window removal

This commit is contained in:
Ian Douglas Scott 2025-06-04 11:45:55 -07:00 committed by Ashley Wulber
parent 89af847930
commit 78153e6240
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 226 additions and 1 deletions

View file

@ -78,6 +78,16 @@ impl PlatformSpecific {
}
}
pub(crate) fn retain_subsurfaces<F: Fn(window::Id) -> bool>(
&mut self,
keep: F,
) {
#[cfg(all(feature = "wayland", target_os = "linux"))]
{
self.wayland.retain_subsurfaces(keep);
}
}
pub(crate) fn clear_subsurface_list(&mut self) {
#[cfg(all(feature = "wayland", target_os = "linux"))]
{

View file

@ -212,6 +212,13 @@ impl WaylandSpecific {
};
}
pub(crate) fn retain_subsurfaces<F: Fn(window::Id) -> bool>(
&mut self,
keep: F,
) {
self.surface_subsurfaces.retain(|k, v| keep(*k))
}
pub(crate) fn clear_subsurface_list(&mut self) {
let _ = crate::subsurface_widget::take_subsurfaces();
}