Compare commits

...

3 Commits

Author SHA1 Message Date
LeRoyce Pearson 3e48488201 feat: set minimum supported xdg_wm_base to v2
River (and wlroots compositors in general) only support v2 of xdg_wm_base.
The most notable addition seems to be popups, which zig-wayland-wire is
not using ATM.
2024-01-16 01:26:39 -07:00
LeRoyce Pearson b46131a80a fix: return error if a global's version is outdated 2024-01-16 01:26:39 -07:00
LeRoyce Pearson 1d5a5b3265 feat: update to zig 0.12.0-dev.2058+04ac028a2 build changes 2024-01-16 01:26:39 -07:00
3 changed files with 7 additions and 3 deletions

View File

@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const module = b.addModule("wayland", .{ const module = b.addModule("wayland", .{
.source_file = .{ .path = "src/main.zig" }, .root_source_file = .{ .path = "src/main.zig" },
}); });
const lib = b.addStaticLibrary(.{ const lib = b.addStaticLibrary(.{
@ -41,6 +41,6 @@ pub fn build(b: *std.Build) void {
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
client_connect_exe.addModule("wayland", module); client_connect_exe.root_module.addImport("wayland", module);
b.installArtifact(client_connect_exe); b.installArtifact(client_connect_exe);
} }

View File

@ -416,6 +416,10 @@ pub fn registerGlobals(alloc: std.mem.Allocator, id_pool: *IdPool, socket: std.n
.global => |global| { .global => |global| {
var buffer: [20]u32 = undefined; var buffer: [20]u32 = undefined;
if (map.get(global.interface)) |item| { if (map.get(global.interface)) |item| {
if (global.version < item.version) {
// TODO: Add diagnostics API
return error.OutdatedCompositorProtocol;
}
const new_id = id_pool.create(); const new_id = id_pool.create();
ids[item.index] = new_id; ids[item.index] = new_id;
const message = try serialize(core.Registry.Request, &buffer, registry_id, .{ .bind = .{ const message = try serialize(core.Registry.Request, &buffer, registry_id, .{ .bind = .{

View File

@ -1,6 +1,6 @@
pub const WmBase = struct { pub const WmBase = struct {
pub const INTERFACE = "xdg_wm_base"; pub const INTERFACE = "xdg_wm_base";
pub const VERSION = 4; pub const VERSION = 2;
pub const Request = union(Request.Tag) { pub const Request = union(Request.Tag) {
destroy: void, destroy: void,