╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │355 } │ │356 } │ │357 │ │360 - pub fn build(self: *Spacer, constraint: layout.Constraint, root_focus: *Focus) !void { │ │358 + pub fn build(self: *Spacer, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │359 _ = root_focus; │ │360 self.clearGrid(); │ │361 const width = constraint.max_size.width orelse return; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │362 if (width == 0) return; │ │365 - self.grid = try Grid.init(self.allocator, .{ .width = width, .height = 1 }); │ │363 + self.grid = try Grid.init(allocator, .{ .width = width, .height = 1 }); │ │364 } │ │365 │ │368 - pub fn input(self: *Spacer, key: inp.Key, root_focus: *Focus) !void { │ │366 + pub fn input(self: *Spacer, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) !void {│ │367 _ = self; │ │368 + _ = allocator; │ │369 _ = key; │ │370 _ = root_focus; │ │371 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │389 // a single-child wrapper that builds the child at its natural size and│ │390 // positions its grid in the middle of the area granted by the parent │ │391 pub const Center = struct { │ │393 - allocator: std.mem.Allocator, │ │392 focus: Focus, │ │393 grid: ?Grid, │ │394 child: *Widget, │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────╮ │401 errdefer allocator.destroy(child); │ │402 child.* = child_widget; │ │403 return .{ │ │406 - .allocator = allocator, │ │404 .focus = Focus.init(allocator, .container),│ │405 .grid = null, │ │406 .child = child, │ ╰────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │408 }; │ │409 } │ │410 │ │414 - pub fn deinit(self: *Center) void { │ │411 + pub fn deinit(self: *Center, allocator: std.mem.Allocator) void {│ │412 self.focus.deinit(); │ │413 if (self.grid) |*grid| { │ │414 grid.deinit(); │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │415 self.grid = null; │ │416 } │ │420 - self.child.deinit(); │ │421 - self.allocator.destroy(self.child); │ │417 + self.child.deinit(allocator); │ │418 + allocator.destroy(self.child); │ │419 } │ │420 │ │424 - pub fn build(self: *Center, constraint: layout.Constraint, root_focus: *Focus) !void { │ │421 + pub fn build(self: *Center, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │422 self.clearGrid(); │ │423 self.getFocus().clear(); │ │424 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │425 // build the child without forcing it to fill min_size; it sizes│ │426 // itself to its content within the available max. │ │430 - try self.child.build(.{ │ │427 + try self.child.build(allocator, .{ │ │428 .min_size = .{ .width = null, .height = null }, │ │429 .max_size = constraint.max_size, │ │430 }, root_focus); │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │444 else │ │445 0; │ │446 │ │450 - var grid = try Grid.init(self.allocator, .{ .width = width, .height = height }); │ │447 + var grid = try Grid.init(allocator, .{ .width = width, .height = height }); │ │448 errdefer grid.deinit(); │ │449 try grid.drawGrid(child_grid, offset_x, offset_y); │ │450 try self.getFocus().addChild(self.child.getFocus(), child_grid.size, offset_x, offset_y);│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │453 self.grid = grid; │ │454 } │ │455 │ │459 - pub fn input(self: *Center, key: inp.Key, root_focus: *Focus) !void { │ │460 - try self.child.input(key, root_focus); │ │456 + pub fn input(self: *Center, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) !void {│ │457 + try self.child.input(allocator, key, root_focus); │ │458 } │ │459 │ │460 pub fn clearGrid(self: *Center) void { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯