Breaking change: Object.interface() renamed to Object.getInterface() for
consistency and to avoid shadowing.
Note: this test doesn't function properly with zig 0.7.0, this issue has
been fixed in https://github.com/ziglang/zig/pull/7178
The simplest and most flexible way to handle things is to stop linking
wayland-client/wayland-server for the user and let them handle it,
always generating bindings for both. This greatly simplifies integration
with projects using both client and server bindings in different
LibExeObjSteps.
A protocol as defined in "wlr-screencopy-unstable-v1.xml", named
"wlr_screencopy_unstable_v1" will emit something like this in
commons.zig
pub const wlr = struct {pub usingnamespace @import("wlr_screencopy_unstable_v1_common.zig");};
under the name "wlr". That is the prefix derived from the protocol name.
Definitions in client/server however use the interface's name to get the
namespace, which for an interface such as "zwlr_screencopy_manager_v1"
would result in references to commons.zig like this:
pub const Error = common.zwlr.layer_shell_v1.Error;
Those references break. This change passes the namespace from the
protocol down to the interface emitters.
Fixes the following error:
./zig-wayland/common.zig:75:44: error: cannot cast a value of type '.wayland.common.Fixed'
4 => @bitCast(f.field_type, args[i].u),
^
./zig-wayland/common.zig:75:44: note: use @intToEnum for type coercion
4 => @bitCast(f.field_type, args[i].u),
^
./zig-wayland/common.zig:75:64: note: referenced here
4 => @bitCast(f.field_type, args[i].u),
The previous code would always generate this:
.{ o = @ptrCast(*common.Object, argument) },
That fails if `argument` is optional, with this change, it generates
this instead:
.{ o = if (argument) |o| @ptrCast(*common.Object, o) else null },
The current code compares "allow_null" (with underscore) against
"allow-null" (with hyphen) from the XML. That always fails and
allow_null is left to the default value.
All of the necessary pieces are re-exported in wayland.server.wl and
wayland.client.wl, which makes the package nicer to use as only one
import is needed.