From f0f2124949056e3008416dcd089766a2ef69a08b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 27 Aug 2025 20:21:34 +0200 Subject: add wl.buffer and wl.surface --- src/wl/compositor.zig | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/wl/compositor.zig') diff --git a/src/wl/compositor.zig b/src/wl/compositor.zig index 18db0f0..ae8d15e 100644 --- a/src/wl/compositor.zig +++ b/src/wl/compositor.zig @@ -5,7 +5,7 @@ const wl = wayland.wl; const Self = @This(); pub const Events = wayland.EventSet(Self, .{}); -pub const Requests = union(enum) { +pub const Request = union(enum) { create_surface: struct { wayland.Object.Ref }, create_region: struct { wayland.Object.Ref }, }; @@ -52,3 +52,17 @@ pub fn format( try writer.print("wl.compositor", .{}); } + +pub fn create_surface( + self: *Self, + ctx: *const wayland.Context +) !*wl.Surface { + const surface = try ctx.allocator.create(wl.Surface); + errdefer ctx.allocator.destroy(surface); + + try surface.init(ctx); + + try ctx.display.request(self, .{ .create_surface = .{ surface.handle } }); + + return surface; +} -- cgit v1.2.3-70-g09d2