diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-08-30 15:49:18 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-08-30 15:49:18 +0200 |
| commit | a46436e58beaaa322c082af5e886f96fd31d7a08 (patch) | |
| tree | 05a05b149c2f18cb0562aef94fe41bd5aaad9fbc /src/wl/buffer.zig | |
| parent | 4feb8c7dab2b0a3492b8248ee12c3f0a475106f1 (diff) | |
Diffstat (limited to 'src/wl/buffer.zig')
| -rw-r--r-- | src/wl/buffer.zig | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/wl/buffer.zig b/src/wl/buffer.zig index fe69899..ae52196 100644 --- a/src/wl/buffer.zig +++ b/src/wl/buffer.zig @@ -12,29 +12,13 @@ pub fn Buffer(fmt: wl.Shm.Format) type { pub const Events = wayland.EventSet(Self, .{}); - handle: wayland.Object.Ref, + handle: wayland.Object.Ref = .null, + init: wayland.Object.interface.Init(Self) = .{}, + data: []wl.Shm.Format.Pixel(fmt), width: usize, height: usize, - pub fn init( - self: *Self, - ctx: wayland.Context, - width: usize, - height: usize, - data: []u8, - ) !void { - self.* = .{ - .handle = try ctx.display.registry.add_object( - ctx.allocator, - wayland.Object.from_self(self), - ), - .data = @alignCast(@ptrCast(data)), - .width = width, - .height = height, - }; - } - pub fn format( self: *const Self, comptime f: []const u8, @@ -44,7 +28,11 @@ pub fn Buffer(fmt: wl.Shm.Format) type { _ = f; _ = options; - try writer.print("wl.buffer<{s}> {{ {}x{} }}", .{@tagName(fmt), self.width, self.height}); + try writer.print("wl.buffer<{s}> {{ {}x{} }}", .{ + @tagName(fmt), + self.width, + self.height + }); } }; } |