From ce8d8a7825576a011001f1decada8a05a5ca2ad2 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Mon, 27 Apr 2020 19:58:44 +0200 Subject: [PATCH] Arrange layers on layer surface destroy Fixes https://github.com/ifreund/river/issues/15 --- src/layer_surface.zig | 9 ++------- src/output.zig | 8 +++++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/layer_surface.zig b/src/layer_surface.zig index 105eaad..e4d4344 100644 --- a/src/layer_surface.zig +++ b/src/layer_surface.zig @@ -52,11 +52,6 @@ pub const LayerSurface = struct { c.wl_signal_add(&self.wlr_layer_surface.events.unmap, &self.listen_unmap); } - /// Send a configure event to the client with the dimensions of the current box - pub fn sendConfigure(self: Self) void { - c.wlr_layer_surface_v1_configure(self.wlr_layer_surface, self.box.width, self.box.height); - } - fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { const self = @fieldParentPtr(Self, "listen_destroy", listener.?); const output = self.output; @@ -71,6 +66,8 @@ pub const LayerSurface = struct { const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self); output.layers[@intCast(usize, @enumToInt(self.layer))].remove(node); output.root.server.allocator.destroy(node); + + self.output.arrangeLayers(); } fn handleMap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { @@ -92,8 +89,6 @@ pub const LayerSurface = struct { wlr_layer_surface.surface, wlr_layer_surface.output, ); - - self.output.arrangeLayers(); } fn handleUnmap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { diff --git a/src/output.zig b/src/output.zig index 7ef053f..5530b77 100644 --- a/src/output.zig +++ b/src/output.zig @@ -464,7 +464,13 @@ pub const Output = struct { } } - layer_surface.sendConfigure(); + // Tell the client to assume the new size + Log.Debug.log("send configure, {} x {}", .{ layer_surface.box.width, layer_surface.box.height }); + c.wlr_layer_surface_v1_configure( + layer_surface.wlr_layer_surface, + layer_surface.box.width, + layer_surface.box.height, + ); } }