mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-14 08:01:14 +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) {
|
fn toplevel_destroyed(&mut self, surface: ToplevelSurface) {
|
||||||
tracing::debug!("toplevel destroyed");
|
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 {
|
let Some(window) = self.pinnacle.window_for_surface(surface.wl_surface()) else {
|
||||||
return;
|
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) {
|
if let Some(output) = window.output(&self.pinnacle) {
|
||||||
self.pinnacle.request_layout(&output);
|
self.pinnacle.request_layout(&output);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue