diff options
| author | Adam Malczewski <[email protected]> | 2026-06-12 19:24:22 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-12 19:24:22 +0900 |
| commit | 8d7749516d70b8a27df4441c2b3e717de1a7a724 (patch) | |
| tree | 9b0cb1257cd6d7859972b990710ebf69ac293db4 /packages/host-bin/src/main.cpp | |
| parent | a21f705692595ea711a736e2ae9c256c1dde7b1e (diff) | |
| download | unbox-8d7749516d70b8a27df4441c2b3e717de1a7a724.tar.gz unbox-8d7749516d70b8a27df4441c2b3e717de1a7a724.zip | |
Slice 2: tinywl port — kernel compositor runs nested, manages toplevels, touch added
Server contract (pimpl, create/run/dispatch/terminate) over a faithful
tinywl 0.20.1 port: outputs via wlr_scene, xdg-shell toplevels+popups,
focus, interactive move/resize, keyboard/pointer through wlr_cursor — plus
touch (down/up/motion/cancel/frame via seat notifies with per-point origin
tracking), which tinywl lacks. RAII Listener replaces manual wl_list_remove
bookkeeping; shutdown ordering documented in kernel.md. xkbcommon added as
a system dep. Verified: nested under labwc (output WL-1, foot mapped and
focused on GLES2) and a headless+pixman boot test in the kernel suite.
Diffstat (limited to 'packages/host-bin/src/main.cpp')
| -rw-r--r-- | packages/host-bin/src/main.cpp | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/packages/host-bin/src/main.cpp b/packages/host-bin/src/main.cpp index 713186d..eb3892c 100644 --- a/packages/host-bin/src/main.cpp +++ b/packages/host-bin/src/main.cpp @@ -1,14 +1,39 @@ #include <unbox/kernel/kernel.hpp> +#include <unbox/kernel/server.hpp> #include <cstdio> +#include <exception> +#include <string_view> -auto main() -> int { - const bool probe_ok = unbox::kernel::link_probe(); +namespace { - std::printf("unbox 0.0.1 — kernel skeleton (slice 1)\n"); - std::printf(" wlroots %s\n", unbox::kernel::wlroots_version().c_str()); - std::printf(" RmlUi %s\n", unbox::kernel::rmlui_version().c_str()); - std::printf(" link probe %s\n", probe_ok ? "ok" : "FAILED"); +void print_usage(const char* argv0) { + std::printf("usage: %s [-s <startup command>]\n", argv0); +} + +} // namespace + +auto main(int argc, char* argv[]) -> int { + unbox::kernel::Server::Options options; + for (int i = 1; i < argc; ++i) { + const std::string_view arg = argv[i]; + if (arg == "-s" && i + 1 < argc) { + options.startup_cmd = argv[++i]; + } else { + print_usage(argv[0]); + return arg == "-h" ? 0 : 1; + } + } - return probe_ok ? 0 : 1; + try { + auto server = unbox::kernel::Server::create(std::move(options)); + std::printf("unbox 0.0.1 (wlroots %s, RmlUi %s) on WAYLAND_DISPLAY=%s\n", + unbox::kernel::wlroots_version().c_str(), + unbox::kernel::rmlui_version().c_str(), server->socket_name().c_str()); + server->run(); + } catch (const std::exception& e) { + std::fprintf(stderr, "unbox: fatal: %s\n", e.what()); + return 1; + } + return 0; } |
