aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-08-27 20:21:34 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2025-08-27 20:21:34 +0200
commitf0f2124949056e3008416dcd089766a2ef69a08b (patch)
tree7e8f674fda0c5af7f30671e9dd088f7ec7d35e5e /src/main.zig
parent8a7392dea729d3ed49a8bf8eee25906c4fd616ac (diff)
add wl.buffer and wl.surface
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index b822109..f02a603 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -44,8 +44,19 @@ pub fn main() !void {
log.debug("{}", .{shm});
}
- const pool = try wl.Shm.instances.items[0].create_pool(&ctx, 1024);
+ const pool = try wl.Shm.instances.items[0].create_pool(&ctx, 800 * 600 * (wl.Shm.Format.argb8888).bytes_per_pixel());
defer pool.deinit(&ctx);
try display.roundtrip(allocator);
+
+ const buffer = try pool.create_buffer(&ctx, 0, 800, 600, .argb8888);
+ defer ctx.display.request(buffer, .{ .destroy = {} }) catch |e| log.err("error {}", .{e});
+
+ const surface = try wl.Compositor.instances.items[0].create_surface(&ctx);
+ defer surface.deinit(&ctx);
+
+ try display.roundtrip(allocator);
+
+ log.debug("{}", .{buffer});
+ log.debug("{}", .{surface});
}