globals.zig (531B)
1 const std = @import("std"); 2 const wayland = @import("wayland"); 3 const wl = wayland.client.wl; 4 5 pub fn main() !void { 6 const display = try wl.Display.connect(null); 7 const registry = try display.getRegistry(); 8 var foo: u32 = 42; 9 registry.setListener(*u32, listener, &foo); 10 if (display.roundtrip() != .SUCCESS) return error.RoundtripFailed; 11 } 12 13 fn listener(_: *wl.Registry, event: wl.Registry.Event, data: *u32) void { 14 std.debug.print("foo is {}\n", .{data.*}); 15 std.debug.print("event is {}\n", .{event}); 16 }