Skip to content

Commit

Permalink
content-type-v1: add bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
hadiali6 authored and ifreund committed Dec 21, 2024
1 parent 772a24d commit d6c3373
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub fn build(b: *std.Build) void {
scanner.addSystemProtocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml");
scanner.addSystemProtocol("staging/cursor-shape/cursor-shape-v1.xml");
scanner.addSystemProtocol("staging/tearing-control/tearing-control-v1.xml");
scanner.addSystemProtocol("staging/content-type/content-type-v1.xml");

scanner.addCustomProtocol(b.path("protocol/wlr-layer-shell-unstable-v1.xml"));
scanner.addCustomProtocol(b.path("protocol/wlr-output-power-management-unstable-v1.xml"));
Expand All @@ -50,6 +51,7 @@ pub fn build(b: *std.Build) void {
scanner.generate("zwp_linux_dmabuf_v1", 4);
scanner.generate("wp_cursor_shape_manager_v1", 1);
scanner.generate("wp_tearing_control_manager_v1", 1);
scanner.generate("wp_content_type_manager_v1", 1);

scanner.generate("zwlr_layer_shell_v1", 4);
scanner.generate("zwlr_output_power_manager_v1", 1);
Expand Down
23 changes: 23 additions & 0 deletions src/types/content_type_v1.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const wlr = @import("../wlroots.zig");

const wayland = @import("wayland");
const wl = wayland.server.wl;
const wp = wayland.server.wp;

pub const ContentTypeManagerV1 = extern struct {
global: *wl.Global,

events: extern struct {
destroy: wl.Signal(void),
},

data: ?*anyopaque,

extern fn wlr_content_type_manager_v1_create(server: *wl.Server, version: u32) ?*ContentTypeManagerV1;
pub fn create(server: *wl.Server, version: u32) !*ContentTypeManagerV1 {
return wlr_content_type_manager_v1_create(server, version) orelse error.OutOfMemory;
}

extern fn wlr_surface_get_content_type_v1(manager: *ContentTypeManagerV1, surface: *wlr.Surface) wp.ContentTypeV1.Type;
pub const get = wlr_surface_get_content_type_v1;
};
2 changes: 2 additions & 0 deletions src/wlroots.zig
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ pub const ForeignToplevelHandleV1 = @import("types/foreign_toplevel_management_v
pub const SecurityContextManagerV1 = @import("types/security_context_v1.zig").SecurityContextManagerV1;
pub const SecurityContextV1State = @import("types/security_context_v1.zig").SecurityContextV1State;

pub const ContentTypeManagerV1 = @import("types/content_type_v1.zig").ContentTypeManagerV1;

pub const SceneNode = @import("types/scene.zig").SceneNode;
pub const Scene = @import("types/scene.zig").Scene;
pub const SceneTree = @import("types/scene.zig").SceneTree;
Expand Down

0 comments on commit d6c3373

Please sign in to comment.