refactor(gui): trace wio events

This commit is contained in:
CJ van den Berg 2026-04-09 16:42:02 +02:00
parent 4b4e2465c7
commit 27794ef4f2
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -439,6 +439,7 @@ fn wioLoop() void {
// during createWindow. This ensures dpi_scale and win_size are correct before // during createWindow. This ensures dpi_scale and win_size are correct before
// the first reloadFont / sendResize, avoiding a brief render at the wrong scale. // the first reloadFont / sendResize, avoiding a brief render at the wrong scale.
while (window.getEvent()) |event| { while (window.getEvent()) |event| {
thespian.trace(thespian.channel.event, .{ "wio", "init", event });
switch (event) { switch (event) {
.scale => |s| dpi_scale = s, .scale => |s| dpi_scale = s,
.size_physical => |sz| win_size = sz, .size_physical => |sz| win_size = sz,
@ -447,6 +448,7 @@ fn wioLoop() void {
} }
// Notify the tui that the window is ready // Notify the tui that the window is ready
thespian.trace(thespian.channel.event, .{ "wio", "WindowCreated", win_size.width, win_size.height });
reloadFont(); reloadFont();
sendResize(win_size, &state, &cell_width, &cell_height); sendResize(win_size, &state, &cell_width, &cell_height);
tui_pid.send(.{ "RDR", "WindowCreated", @as(usize, 0) }) catch {}; tui_pid.send(.{ "RDR", "WindowCreated", @as(usize, 0) }) catch {};
@ -463,6 +465,7 @@ fn wioLoop() void {
maybeReloadFont(win_size, &state, &cell_width, &cell_height); maybeReloadFont(win_size, &state, &cell_width, &cell_height);
while (window.getEvent()) |event| { while (window.getEvent()) |event| {
thespian.trace(thespian.channel.event, .{ "wio", "event", event });
switch (event) { switch (event) {
.close => { .close => {
running = false; running = false;
@ -579,7 +582,9 @@ fn wioLoop() void {
held_buttons = .{}; held_buttons = .{};
tui_pid.send(.{"focus_out"}) catch {}; tui_pid.send(.{"focus_out"}) catch {};
}, },
else => {}, else => {
std.log.debug("wio unhandled event: {}", .{event});
},
} }
} }