aboutsummaryrefslogtreecommitdiff
path: root/src/wl/compositor.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-08-27 20:21:34 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2025-08-27 20:21:34 +0200
commitf0f2124949056e3008416dcd089766a2ef69a08b (patch)
tree7e8f674fda0c5af7f30671e9dd088f7ec7d35e5e /src/wl/compositor.zig
parent8a7392dea729d3ed49a8bf8eee25906c4fd616ac (diff)
add wl.buffer and wl.surface
Diffstat (limited to 'src/wl/compositor.zig')
-rw-r--r--src/wl/compositor.zig16
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;
+}