···299299300300 // Insert the child to the beginning of the list
301301 const col_offset: i17 = if (self.draw_cursor) 2 else 0;
302302- try child_list.insert(0, .{
302302+ try child_list.insert(ctx.arena, 0, .{
303303 .origin = .{ .col = col_offset - @as(i17, @intCast(self.scroll.left)), .row = upheight },
304304 .surface = surf,
305305 .z_index = 0,
···352352 self.scroll.has_more_vertical = true;
353353 }
354354355355- var child_list = std.ArrayList(vxfw.SubSurface).init(ctx.arena);
355355+ var child_list: std.ArrayList(vxfw.SubSurface) = .empty;
356356357357 // Accumulated height tracks how much height we have drawn. It's initial state is
358358 // -(scroll.vertical_offset + scroll.pending_lines) lines _above_ the surface top edge.
···413413 const surf = try child.draw(child_ctx);
414414415415 // Add the child surface to our list. It's offset from parent is the accumulated height
416416- try child_list.append(.{
416416+ try child_list.append(ctx.arena, .{
417417 .origin = .{ .col = child_offset - @as(i17, @intCast(self.scroll.left)), .row = accumulated_height },
418418 .surface = surf,
419419 .z_index = 0,
···501501 // unbounded drawing in scrollable areas
502502 self.scroll.top = self.cursor;
503503 self.scroll.vertical_offset = 0;
504504- child_list.deinit();
505505- try child_list.append(.{
504504+ child_list.deinit(ctx.arena);
505505+ try child_list.append(ctx.arena, .{
506506 .origin = .{ .col = 0 - @as(i17, @intCast(self.scroll.left)), .row = 0 },
507507 .surface = sub.surface,
508508 .z_index = 0,
···645645 };
646646 // Event handlers need a context
647647 var ctx: vxfw.EventContext = .{
648648- .cmds = std.ArrayList(vxfw.Command).init(std.testing.allocator),
648648+ .alloc = std.testing.allocator,
649649+ .cmds = .empty,
649650 };
650650- defer ctx.cmds.deinit();
651651+ defer ctx.cmds.deinit(ctx.alloc);
651652652653 try scroll_widget.handleEvent(&ctx, .{ .mouse = mouse_event });
653654 // Wheel up doesn't adjust the scroll
···10431044 };
10441045 // Event handlers need a context
10451046 var ctx: vxfw.EventContext = .{
10461046- .cmds = std.ArrayList(vxfw.Command).init(std.testing.allocator),
10471047+ .alloc = std.testing.allocator,
10481048+ .cmds = .empty,
10471049 };
10481048- defer ctx.cmds.deinit();
10501050+ defer ctx.cmds.deinit(ctx.alloc);
1049105110501052 // Send a wheel down x 3
10511053 mouse_event.button = .wheel_down;
+4-1
src/vxfw/Spinner.zig
···123123124124 // We are about to deliver the tick to the widget. We need an EventContext (the engine will
125125 // provide this)
126126- var ctx: vxfw.EventContext = .{ .cmds = vxfw.CommandList.init(arena.allocator()) };
126126+ var ctx: vxfw.EventContext = .{
127127+ .alloc = arena.allocator(),
128128+ .cmds = .empty,
129129+ };
127130128131 // The event loop handles the tick event and calls us back with a .tick event. If we should keep
129132 // running, we will add a new tick event
+2-1
src/vxfw/SplitView.zig
···227227 };
228228229229 var ctx: vxfw.EventContext = .{
230230- .cmds = std.ArrayList(vxfw.Command).init(arena.allocator()),
230230+ .alloc = arena.allocator(),
231231+ .cmds = .empty,
231232 };
232233 try split_widget.handleEvent(&ctx, .{ .mouse = mouse });
233234 // We should get a command to change the mouse shape
+2-1
src/vxfw/TextField.zig
···567567 _ = draw_ctx;
568568569569 var ctx: vxfw.EventContext = .{
570570- .cmds = vxfw.CommandList.init(arena.allocator()),
570570+ .alloc = arena.allocator(),
571571+ .cmds = .empty,
571572 };
572573573574 // Enough boiler plate...Create the text field
+2-1
src/vxfw/vxfw.zig
···9999100100pub const EventContext = struct {
101101 phase: Phase = .at_target,
102102+ alloc: Allocator,
102103 cmds: CommandList,
103104104105 /// The event was handled, do not pass it on
···115116 };
116117117118 pub fn addCmd(self: *EventContext, cmd: Command) Allocator.Error!void {
118118- try self.cmds.append(cmd);
119119+ try self.cmds.append(self.alloc, cmd);
119120 }
120121121122 pub fn tick(self: *EventContext, ms: u32, widget: Widget) Allocator.Error!void {