git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit9af491f4cb6f85b385d5a2b9452a45c9ae2d03fe
parent8102524e97
authorIsaac Freund <[email protected]>
date2020-04-27 19:58
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,
+            );
         }
     }