From 8a7392dea729d3ed49a8bf8eee25906c4fd616ac Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 27 Aug 2025 09:02:43 +0200 Subject: Add ancillary data mechanism to send fds to compositor. Currently we are just attaching the fds to the object id. In theory this is not a valid implementation, since if we have more than MAX_FD file descriptors this will not work. But since this wont be the case in basically all cases of the wayland protocol, we can just ignore that for now. --- src/main.zig | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index b6806be..b822109 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2,6 +2,14 @@ const std = @import("std"); const wayland = @import("wayland"); const wl = wayland.wl; +const log = std.log.scoped(.main); + +pub const std_options = std.Options{ + .log_scope_levels = &.{ + .{ .scope = .registry, .level = .info }, + } +}; + pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); @@ -17,15 +25,27 @@ pub fn main() !void { try display.roundtrip(allocator); try display.roundtrip(allocator); + const ctx: wayland.Context = .{ + .allocator = allocator, + .display = &display, + }; + + try display.roundtrip(allocator); + for (wl.Output.instances.items) |output| { - std.debug.print("{}\n", .{output}); + log.debug("{}", .{output}); } for (wl.Compositor.instances.items) |compositor| { - std.debug.print("{}\n", .{compositor}); + log.debug("{}", .{compositor}); } for (wl.Shm.instances.items) |shm| { - std.debug.print("{}\n", .{shm}); + log.debug("{}", .{shm}); } + + const pool = try wl.Shm.instances.items[0].create_pool(&ctx, 1024); + defer pool.deinit(&ctx); + + try display.roundtrip(allocator); } -- cgit v1.2.3-70-g09d2