ensure that when a surface is closed that it is no longer focused

this fixes the regression introduced in the previous commit
This commit is contained in:
Squibid 2025-12-22 20:52:25 -05:00
parent 1215b8e5de
commit afed68101c
Signed by: squibid
GPG key ID: BECE5684D3C4005D
2 changed files with 12 additions and 0 deletions

View file

@ -113,6 +113,12 @@ fn handleMap(
fn handleUnmap(listener: *wl.Listener(void)) void { fn handleUnmap(listener: *wl.Listener(void)) void {
const layer_surface: *LayerSurface = @fieldParentPtr("unmap", listener); const layer_surface: *LayerSurface = @fieldParentPtr("unmap", listener);
if (server.seat.focused_surface) |fs| {
if (fs == .layer_surface and fs.layer_surface == layer_surface) {
server.seat.focusSurface(null);
}
}
// FIXME: this crashes mez when killing mez // FIXME: this crashes mez when killing mez
layer_surface.output.arrangeLayers(); layer_surface.output.arrangeLayers();

View file

@ -166,6 +166,12 @@ fn handleUnmap(listener: *wl.Listener(void)) void {
view.mapped = false; // we do this before any work is done so that nobody tries view.mapped = false; // we do this before any work is done so that nobody tries
// any funny business // any funny business
if (server.seat.focused_surface) |fs| {
if (fs == .view and fs.view == view) {
server.seat.focusSurface(null);
}
}
view.request_fullscreen.link.remove(); view.request_fullscreen.link.remove();
view.request_move.link.remove(); view.request_move.link.remove();
view.request_resize.link.remove(); view.request_resize.link.remove();