diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig index 400df48..0d5c6bd 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,6 +1,7 @@ const std = @import("std"); const wayland = @import("wayland"); const wl = wayland.wl; +const xdg = wayland.xdg; const log = std.log.scoped(.main); @@ -20,6 +21,7 @@ pub fn main() !void { wl.Output.handler, wl.Compositor.handler, wl.Shm.handler, + xdg.WmBase.handler, }); try display.roundtrip(allocator); @@ -32,19 +34,26 @@ pub fn main() !void { try display.roundtrip(allocator); - for (wl.Output.instances.items) |output| { + for (wl.Output.globals.as_slice()) |output| { log.debug("{}", .{output}); } - for (wl.Compositor.instances.items) |compositor| { + for (wl.Compositor.globals.as_slice()) |compositor| { log.debug("{}", .{compositor}); } - for (wl.Shm.instances.items) |shm| { + for (wl.Shm.globals.as_slice()) |shm| { log.debug("{}", .{shm}); } - const pool = try wl.Shm.instances.items[0].create_pool(ctx, 800 * 600 * (wl.Shm.Format.argb8888).bytes_per_pixel()); + for (xdg.WmBase.globals.as_slice()) |wm_base| { + log.debug("{}", .{wm_base}); + } + + const pool = try wl.Shm + .globals + .get(0).? + .create_pool(ctx, 800 * 600 * (wl.Shm.Format.argb8888).bytes_per_pixel()); defer pool.deinit(ctx); try display.roundtrip(allocator); @@ -52,7 +61,7 @@ pub fn main() !void { 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); + const surface = try wl.Compositor.globals.get(0).?.create_surface(ctx); defer surface.deinit(ctx); try display.roundtrip(allocator); |