fix indentation

This commit is contained in:
Squibid 2025-10-16 17:37:19 -04:00
parent 9cb148e3b1
commit 293a9e2d3e
Signed by: squibid
GPG key ID: BECE5684D3C4005D

View file

@ -8,57 +8,57 @@ const wlr = @import("wlroots");
const Server = @import("server.zig").Server; const Server = @import("server.zig").Server;
pub const Output = struct { pub const Output = struct {
server: *Server, server: *Server,
wlr_output: *wlr.Output, wlr_output: *wlr.Output,
frame: wl.Listener(*wlr.Output) = .init(handleFrame), frame: wl.Listener(*wlr.Output) = .init(handleFrame),
request_state: wl.Listener(*wlr.Output.event.RequestState) = .init(handleRequestState), request_state: wl.Listener(*wlr.Output.event.RequestState) = .init(handleRequestState),
destroy: wl.Listener(*wlr.Output) = .init(handleDestroy), destroy: wl.Listener(*wlr.Output) = .init(handleDestroy),
// The wlr.Output should be destroyed by the caller on failure to trigger cleanup. // The wlr.Output should be destroyed by the caller on failure to trigger cleanup.
pub fn create(server: *Server, wlr_output: *wlr.Output) !void { pub fn create(server: *Server, wlr_output: *wlr.Output) !void {
const output = try gpa.create(Output); const output = try gpa.create(Output);
output.* = .{ output.* = .{
.server = server, .server = server,
.wlr_output = wlr_output, .wlr_output = wlr_output,
}; };
wlr_output.events.frame.add(&output.frame); wlr_output.events.frame.add(&output.frame);
wlr_output.events.request_state.add(&output.request_state); wlr_output.events.request_state.add(&output.request_state);
wlr_output.events.destroy.add(&output.destroy); wlr_output.events.destroy.add(&output.destroy);
const layout_output = try server.output_layout.addAuto(wlr_output); const layout_output = try server.output_layout.addAuto(wlr_output);
const scene_output = try server.scene.createSceneOutput(wlr_output); const scene_output = try server.scene.createSceneOutput(wlr_output);
server.scene_output_layout.addOutput(layout_output, scene_output); server.scene_output_layout.addOutput(layout_output, scene_output);
} }
pub fn handleFrame(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void { pub fn handleFrame(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {
const output: *Output = @fieldParentPtr("frame", listener); const output: *Output = @fieldParentPtr("frame", listener);
const scene_output = output.server.scene.getSceneOutput(output.wlr_output).?; const scene_output = output.server.scene.getSceneOutput(output.wlr_output).?;
_ = scene_output.commit(null); _ = scene_output.commit(null);
var now = posix.clock_gettime(posix.CLOCK.MONOTONIC) catch @panic("CLOCK_MONOTONIC not supported"); var now = posix.clock_gettime(posix.CLOCK.MONOTONIC) catch @panic("CLOCK_MONOTONIC not supported");
scene_output.sendFrameDone(&now); scene_output.sendFrameDone(&now);
} }
pub fn handleRequestState( pub fn handleRequestState(
listener: *wl.Listener(*wlr.Output.event.RequestState), listener: *wl.Listener(*wlr.Output.event.RequestState),
event: *wlr.Output.event.RequestState, event: *wlr.Output.event.RequestState,
) void { ) void {
const output: *Output = @fieldParentPtr("request_state", listener); const output: *Output = @fieldParentPtr("request_state", listener);
_ = output.wlr_output.commitState(event.state); _ = output.wlr_output.commitState(event.state);
} }
pub fn handleDestroy(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void { pub fn handleDestroy(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {
const output: *Output = @fieldParentPtr("destroy", listener); const output: *Output = @fieldParentPtr("destroy", listener);
output.frame.link.remove(); output.frame.link.remove();
output.request_state.link.remove(); output.request_state.link.remove();
output.destroy.link.remove(); output.destroy.link.remove();
gpa.destroy(output); gpa.destroy(output);
} }
}; };