summaryrefslogtreecommitdiff
path: root/src/detached/client.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/detached/client.zig')
-rw-r--r--src/detached/client.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/detached/client.zig b/src/detached/client.zig
index affa070e..42404bca 100644
--- a/src/detached/client.zig
+++ b/src/detached/client.zig
@@ -102,6 +102,7 @@ pub const Client = struct {
grid: std.ArrayListUnmanaged(pardes.Cell) = .empty,
cursor: ?wire.Cursor = null,
pointer_shape: pardes.Surface.PointerShape = .arrow,
+ body_layers: [pardes.MAX_PANES]pardes.BodyLayer = @splat(.{}),
in: std.ArrayListUnmanaged(u8) = .empty,
out: std.ArrayListUnmanaged(u8) = .empty,
/// Bytes of `in` belonging to the message `next` returned last. Compacted at
@@ -174,6 +175,10 @@ pub const Client = struct {
if (c.fd >= 0) _ = libc.close(c.fd);
c.fd = -1;
c.grid.deinit(c.gpa);
+ for (&c.body_layers) |*layer| {
+ c.gpa.free(layer.cells);
+ layer.* = .{};
+ }
c.in.deinit(c.gpa);
c.out.deinit(c.gpa);
}
@@ -311,6 +316,10 @@ pub const Client = struct {
try c.reshape(f.cols, f.rows);
}
try f.apply(c.grid.items);
+ f.applyLayers(c.gpa, &c.body_layers) catch |err| return switch (err) {
+ error.OutOfMemory => error.Closed,
+ else => @as(wire.Error, @errorCast(err)),
+ };
c.cursor = f.cursor;
c.pointer_shape = f.pointer_shape;
},