diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-17 19:31:38 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-17 19:31:38 +0200 |
| commit | 0557d9df9d0269140f4ae40335720cd74208df9f (patch) | |
| tree | 81655324eda4f61c69157e2feedd358fb5b4df90 /src/output.zig | |
| parent | fb1414a0524d996f912a82abaf2896754afd663a (diff) | |
| download | river-0557d9df9d0269140f4ae40335720cd74208df9f.tar.gz river-0557d9df9d0269140f4ae40335720cd74208df9f.tar.xz | |
Close layer surfaces on output destroy
Diffstat (limited to 'src/output.zig')
| -rw-r--r-- | src/output.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/output.zig b/src/output.zig index 5751421..e951fe3 100644 --- a/src/output.zig +++ b/src/output.zig @@ -379,6 +379,8 @@ pub const Output = struct { const destroyed_output = @fieldParentPtr(Output, "listen_destroy", listener.?); const root = destroyed_output.root; + Log.Debug.log("Output {} destroyed", .{destroyed_output.wlr_output.name}); + // Use the first output in the list that is not the one being destroyed. // If there is no other real output, use the noop output. var output_it = root.outputs.first; @@ -395,6 +397,21 @@ pub const Output = struct { node.view.output = fallback_output; } + // Close all layer surfaces on the destroyed output + for (destroyed_output.layers) |*layer, layer_idx| { + while (layer.pop()) |node| { + const layer_surface = &node.data; + c.wlr_layer_surface_v1_close(layer_surface.wlr_layer_surface); + // We need to move the closing layer surface to the noop output + // since it is not immediately destoryed. This just a request + // to close which will trigger unmap and destroy events in + // response, and the LayerSurface needs a valid output to + // handle them. + root.noop_output.layers[layer_idx].prepend(node); + layer_surface.output = &root.noop_output; + } + } + // If any seat has the destroyed output focused, focus the fallback one var seat_it = root.server.input_manager.seats.first; while (seat_it) |seat_node| : (seat_it = seat_node.next) { |
