mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-13 08:01:05 +01:00
Simplify window removal
This commit is contained in:
parent
feeb139b05
commit
c55a4991c4
1 changed files with 8 additions and 21 deletions
|
@ -48,32 +48,19 @@ impl XdgShellHandler for State {
|
|||
|
||||
fn toplevel_destroyed(&mut self, surface: ToplevelSurface) {
|
||||
tracing::debug!("toplevel destroyed");
|
||||
self.pinnacle.windows.retain(|window| {
|
||||
window
|
||||
.wl_surface()
|
||||
.is_some_and(|surf| &surf != surface.wl_surface())
|
||||
});
|
||||
|
||||
self.pinnacle.z_index_stack.retain(|window| {
|
||||
window
|
||||
.wl_surface()
|
||||
.is_some_and(|surf| &surf != surface.wl_surface())
|
||||
});
|
||||
|
||||
for output in self.pinnacle.space.outputs() {
|
||||
output.with_state_mut(|state| {
|
||||
state.focus_stack.stack.retain(|window| {
|
||||
window
|
||||
.wl_surface()
|
||||
.is_some_and(|surf| &surf != surface.wl_surface())
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
let Some(window) = self.pinnacle.window_for_surface(surface.wl_surface()) else {
|
||||
return;
|
||||
};
|
||||
|
||||
self.pinnacle.windows.retain(|win| win != &window);
|
||||
|
||||
self.pinnacle.z_index_stack.retain(|win| win != &window);
|
||||
|
||||
for output in self.pinnacle.space.outputs() {
|
||||
output.with_state_mut(|state| state.focus_stack.stack.retain(|win| win != &window));
|
||||
}
|
||||
|
||||
if let Some(output) = window.output(&self.pinnacle) {
|
||||
self.pinnacle.request_layout(&output);
|
||||
|
||||
|
|
Loading…
Reference in a new issue