From aae7f237e270ed8fc2ff10f3a661ced618c527cf Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 6 Jan 2024 19:17:22 -0600 Subject: [PATCH] Bind wlr_drm_create() --- src/types/drm.zig | 24 ++++++++++++++++++++++++ src/wlroots.zig | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 src/types/drm.zig diff --git a/src/types/drm.zig b/src/types/drm.zig new file mode 100644 index 0000000..e899de5 --- /dev/null +++ b/src/types/drm.zig @@ -0,0 +1,24 @@ +const wlr = @import("../wlroots.zig"); + +const wayland = @import("wayland"); +const wl = wayland.server.wl; + +pub const Drm = extern struct { + global: *wl.Global, + + events: extern struct { + destroy: wl.Signal(void), + }, + + // private state + + node_name: [*:0]u8, + formats: wlr.DrmFormatSet, + + server_destroy: wl.Listener(*wl.Server), + + extern fn wlr_drm_create(server: *wl.Server, renderer: *wlr.Renderer) ?*Drm; + pub fn create(server: *wl.Server, renderer: *wlr.Renderer) !*Drm { + return wlr_drm_create(server, renderer) orelse error.WlrDrmCreateFailed; + } +}; diff --git a/src/wlroots.zig b/src/wlroots.zig index d616e19..00b0f66 100644 --- a/src/wlroots.zig +++ b/src/wlroots.zig @@ -15,6 +15,8 @@ pub const Swapchain = opaque {}; pub const DrmFormat = @import("render/drm_format_set.zig").DrmFormat; pub const DrmFormatSet = @import("render/drm_format_set.zig").DrmFormatSet; +pub const Drm = @import("types/drm.zig").Drm; + pub const FractionalScaleManagerV1 = @import("types/fractional_scale_v1.zig").FractionalScaleManagerV1; pub const ShmAttributes = @import("types/buffer.zig").ShmAttributes;