This is an Advent of Code solution. Click to reveal!
The cogs are turning...
    
https://zigbin.io/7d8b09Click to copy
https://zigbin.io/7d8b09/runClick to copy
https://zigbin.io/7d8b09/rawClick to copy
// How I can change the type of 'handleFrame' to handle error
frame: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleFrame),

fn handleFrame(listener: *wl.Listener(*wlr.Output), wlr_output: *wlr.Output) !void {
    // This function is called every time an output is ready to display a frame,
    // generally at the output's refresh rate (e.g. 60Hz).
    const self = @fieldParentPtr(Self, "frame", listener);

    var needs_frame: bool = undefined;
    var damage: *pixman.Region32 = undefined;
    damage.init() catch {
        log.debug("Cannot init damage", .{});
        return;
    };

    render.renderOutput(self);
}