Skip to content

Commit

Permalink
shell: Fix closed x11 windows closing stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Sep 12, 2023
1 parent bc3c304 commit 8038034
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/xwayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ impl XwmHandler for Data {
}

fn unmapped_window(&mut self, _xwm: XwmId, window: X11Surface) {
let surface = CosmicSurface::X11(window.clone());
if window.is_override_redirect() {
self.state
.common
Expand All @@ -210,7 +211,7 @@ impl XwmHandler for Data {
.state
.common
.shell
.element_for_surface(&CosmicSurface::X11(window.clone()))
.element_for_surface(&surface)
.cloned()
.and_then(|element| {
self.state
Expand All @@ -220,7 +221,11 @@ impl XwmHandler for Data {
.map(|space| (element, space))
})
{
space.unmap(&element);
if element.is_stack() && element.stack_ref().unwrap().len() >= 2 {
element.stack_ref().unwrap().remove_window(&surface);
} else {
space.unmap(&element);
}
}

let outputs = if let Some(wl_surface) = window.wl_surface() {
Expand Down

0 comments on commit 8038034

Please sign in to comment.