Something went wrong. Try again.
A Wayland client for Zig 0.17 with no libwayland: protocol scanner, sans-I/O wire protocol, socket client, and presentation.
Something went wrong. Try again.
zig-wayland-native CONTRIBUTING.md
2.4 kB
Markdown
at main
Contributing to zig-wayland-native #
Issues and pull requests go to the Tangled mirror, https://tangled.org/jcollie.dev/zig-wayland-native.
Setting up #
Everything the project needs — Zig 0.17, reuse, and the headless
compositors the examples are tested against — comes from the Nix flake:
$ nix develop
Without Nix, you need Zig 0.17.0 or later, and weston and sway for
tools/headless.sh. The Zig build fetches its own dependencies, including the
wayland and wayland-protocols releases; nothing is read from the system.
Before sending a change #
CI runs all of these, and a change should pass them:
$ reuse lint
$ zig fmt --check .
$ zig build test --summary all
$ zig build check
$ ./tools/headless.sh
zig build checkcompiles what the tests do not: the examples and the documentation server.tools/headless.shruns the examples against a headless weston, and the dma-buf and explicit sync stages too where/dev/udmabufand a render node are available. It says so when it skips a stage.
Where things live #
src/scannerreads protocol XML and renders Zig bindings;tools/scanner.zigis the command the build runs.src/protocolis the wire protocol with no I/O. Anything that can be tested with byte slices is tested here.src/clientis the socket, and is Linux-only.src/presentis buffers and presentation, built against the consumer's bindings byaddPresentinbuild.zig.tests/holds the suites that drive the generated bindings and play the compositor over a socketpair;tests/fake.zigis that compositor.examples/are the programszig build run-<name>runs.
Conventions #
- Treat the compositor's input as hostile. Check every length against what arrived before using it, and fail the session with an error on malformed input, never with a panic.
- Be explicit about who owns a file descriptor. If a change moves who closes a descriptor, the doc comments have to say so.
- Put the explanation in doc comments. The API documentation is generated
from them (
zig build docs, andzig build docs-serveto read it). - Keep REUSE compliance. Every new file carries an SPDX header, or an
entry in
REUSE.tomlif it cannot hold one. The code is under the MIT license.