From 956ecb061b1862a4b632c8d5d6b6fa4318e1f640 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 22 Aug 2025 20:12:56 +0200 Subject: object refactor and add wl output Now the Object is held by the registry instead of the struct its referencing and the struct only has a `handle` which is a usize. --- src/wl/output/mode.zig | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/wl/output/mode.zig (limited to 'src/wl/output/mode.zig') diff --git a/src/wl/output/mode.zig b/src/wl/output/mode.zig new file mode 100644 index 0000000..a21e8e0 --- /dev/null +++ b/src/wl/output/mode.zig @@ -0,0 +1,26 @@ +const std = @import("std"); + +const Self = @This(); + +pub const Kind = enum(u32) { + current = 1, + preferred = 2, +}; + +kind: Kind, +width: u32, +height: u32, +refresh: u32, + + +pub fn format( + self: *const Self, + comptime fmt: []const u8, + options: std.fmt.FormatOptions, + writer: anytype, +) !void { + _ = fmt; + _ = options; + const ghz: f32 = @as(f32, @floatFromInt(self.refresh)) / 1000.0; + try writer.print("{}x{}@{d:.2}", .{ self.width, self.height, ghz}); +} -- cgit v1.2.3-70-g09d2