const std = @import("std"); const wayland = @import("../root.zig"); const wl = wayland.wl; const Self = @This(); pub const Events = wayland.EventSet(Self, .{}); pub const Request = union(enum) { create_surface: struct { wayland.Object.Ref }, create_region: struct { wayland.Object.Ref }, }; handle: wayland.Object.Ref, init: wayland.Object.interface.Init(Self) = .{}, pub var globals: wayland.Object.interface.Global(Self) = .init; pub const handler: wl.Registry.GlobalHandler = .{ .interface = "wl_compositor", .version = 6, .handler = globals.register, }; pub fn format( self: *const Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { _ = self; _ = fmt; _ = options; try writer.print("wl.compositor", .{}); } pub fn create_surface( self: *Self, ctx: wayland.Context ) !*wl.Surface { const surface = try ctx.allocator.create(wl.Surface); errdefer ctx.allocator.destroy(surface); try surface.init.default(ctx); try ctx.display.request(self, .{ .create_surface = .{ surface.handle } }); return surface; }