diff options
| author | Adam Malczewski <[email protected]> | 2026-06-12 19:11:59 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-12 19:11:59 +0900 |
| commit | a21f705692595ea711a736e2ae9c256c1dde7b1e (patch) | |
| tree | 2cb3e6380e65f9b584a1dea1cd43e1a127a4f56d /packages/kernel/include | |
| parent | 6f45dc177540d6c6ae7596427209091d4c7adc20 (diff) | |
| download | unbox-a21f705692595ea711a736e2ae9c256c1dde7b1e.tar.gz unbox-a21f705692595ea711a736e2ae9c256c1dde7b1e.zip | |
Slice 1: Meson skeleton — kernel links wlroots 0.20 from C++, RMLUi 6.2 vendored
Root meson.build (C++23, WLR_USE_UNSTABLE, ccache-detected) with RMLUi 6.2
as a wrap-file tarball built through the cmake module (no git submodules —
settled decision) and doctest 2.5.2 from wrapdb. kernel unit: extern-"C"
wlr.hpp wrapper (with the C99 [static N] array-param workaround documented
in kernel.md), slice-1 probe contract, doctest suite (1/1 green). host-bin:
composition root printing versions, exit 0. tasks.md slice 1 done.
Diffstat (limited to 'packages/kernel/include')
| -rw-r--r-- | packages/kernel/include/unbox/kernel/kernel.hpp | 26 | ||||
| -rw-r--r-- | packages/kernel/include/unbox/kernel/wlr.hpp | 28 |
2 files changed, 54 insertions, 0 deletions
diff --git a/packages/kernel/include/unbox/kernel/kernel.hpp b/packages/kernel/include/unbox/kernel/kernel.hpp new file mode 100644 index 0000000..9836a14 --- /dev/null +++ b/packages/kernel/include/unbox/kernel/kernel.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include <string> + +// Slice-1 probe surface: proves the kernel compiles against wlroots from +// C++ and links wlroots, libwayland-server, and the vendored RMLUi. The +// real contracts (extension host, bus, scene/seat glue, ui substrate) +// replace this from slice 2 on. +// +// Calling context: everything in unbox runs on the single wl_event_loop +// thread unless a contract explicitly states otherwise. + +namespace unbox::kernel { + +/// The wlroots version this kernel was compiled against (the 0.20 pin). +[[nodiscard]] auto wlroots_version() -> std::string; + +/// The RMLUi version linked from the vendored subproject. +[[nodiscard]] auto rmlui_version() -> std::string; + +/// Creates and immediately destroys a wl_display: proves we can call into +/// libwayland-server/wlroots at runtime, not just link. Returns true on +/// success. No side effects beyond wlroots log initialization. +[[nodiscard]] auto link_probe() -> bool; + +} // namespace unbox::kernel diff --git a/packages/kernel/include/unbox/kernel/wlr.hpp b/packages/kernel/include/unbox/kernel/wlr.hpp new file mode 100644 index 0000000..6374a52 --- /dev/null +++ b/packages/kernel/include/unbox/kernel/wlr.hpp @@ -0,0 +1,28 @@ +#pragma once + +// The ONLY file in the project allowed to include wlroots / libwayland +// headers (.unbox/rules/wlroots-include.md). wlroots is C; this wrapper +// provides the extern-"C" guards C++ needs. WLR_USE_UNSTABLE is defined +// project-wide in the root meson.build; the version pin is wlroots 0.20. +// +// Grow this include list as kernel glue needs more types — never include +// <wlr/...> anywhere else, in any unit. + +extern "C" { +#include <wayland-server-core.h> + +// wlroots headers use C99 array-parameter syntax (`float color[static 4]`), +// which is invalid C++. Blanking `static` around the wlr includes is the +// proven workaround (Hyprland shipped years on it): `static inline` header +// helpers become plain `inline`, which C++ ODR-merges safely. Keep the +// #define scoped to EXACTLY these includes. +#define static +#include <wlr/backend.h> +#include <wlr/render/allocator.h> +#include <wlr/render/wlr_renderer.h> +#include <wlr/types/wlr_output.h> +#include <wlr/types/wlr_scene.h> +#include <wlr/util/log.h> +#include <wlr/version.h> +#undef static +} |
