aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-08-12 21:58:17 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2021-08-12 21:58:17 +0200
commitd4c249a5cb92dcb188b6c4ba806cc261b1705a80 (patch)
tree4aebc212bdbaae688757f3e08acb5f01cf398ce4
parent1e18ac9d7468c5d37f9c43587e8d87bf81c1f7ca (diff)
downloadriver-d4c249a5cb92dcb188b6c4ba806cc261b1705a80.tar.gz
river-d4c249a5cb92dcb188b6c4ba806cc261b1705a80.tar.xz
output: simplify layer shell handling on destroy
No need for noop output hacks here, wlr.LayerSurfaceV1.close() synchronously emits the unmap signal if the layer surface is mapped.
-rw-r--r--river/Root.zig16
1 files changed, 7 insertions, 9 deletions
diff --git a/river/Root.zig b/river/Root.zig
index 94f6d0a..33792d8 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -178,17 +178,15 @@ pub fn removeOutput(self: *Self, output: *Output) void {
}
// Close all layer surfaces on the removed output
- for (output.layers) |*layer, layer_idx| {
- while (layer.pop()) |layer_node| {
+ for (output.layers) |*layer| {
+ // Closing the layer surface will cause LayerSurface.handleUnmap()
+ // to be called synchronously, which will remove it from this list.
+ while (layer.first) |layer_node| {
const layer_surface = &layer_node.data;
- // We need to move the closing layer surface to the noop output
- // since it may not be 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.
- self.noop_output.layers[layer_idx].prepend(layer_node);
- layer_surface.output = &self.noop_output;
+
layer_surface.wlr_layer_surface.close();
+ layer_surface.wlr_layer_surface.output = null;
+ layer_surface.output = undefined;
}
}