diff options
Diffstat (limited to 'src/wl/compositor.zig')
| -rw-r--r-- | src/wl/compositor.zig | 16 |
1 files changed, 15 insertions, 1 deletions
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; +} |