From e413632668736a5bf87c7d1fc2b30d43fb8f2d31 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Tue, 20 Oct 2026 23:15:25 +0200 Subject: [PATCH] Ui, project: the screenshot through CaptureNextFrame; the libraries pinned Crafter.Graphics 079b6b0 replaced SaveFrame with CaptureNextFrame, and the app no longer built against its master. The copy is now recorded into the next frame before it is presented, where SaveFrame read back an image already handed to the display (validation reported both the layout transition and the missing acquire). The capture is armed first, so the Update that follows draws the frame and writes the file; a file the library cannot write (it throws from the Update) is logged and ends the run with exit 1. project.cpp pins Crafter.Graphics at 079b6b0 and Crafter.DB at bfd0cc2: a commit of either library must not change a build without a commit here. --local builds both from the sibling checkouts, now that the input branch is merged. --- AGENTS.md | 4 ++++ interfaces/ImsdMessages.Ui-App.cppm | 16 ++++++++++++---- project.cpp | 16 ++++++++-------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 615ef52..880a1db 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -48,6 +48,10 @@ crafter-build format --check # what CI gates on A test is an ordinary `int main()`: exit 0 passes. Tests link the core (and the bus library where they need GLib) and never need a bus, a phone or a GPU. +The build takes Crafter.DB and Crafter.Graphics from the forge at the +commits `project.cpp` pins; `crafter-build -- --local` builds them from +sibling checkouts in `../Crafter/` instead. + ## 4. Making changes - Commit messages: subject `area: what changes`, the body says why; no AI diff --git a/interfaces/ImsdMessages.Ui-App.cppm b/interfaces/ImsdMessages.Ui-App.cppm index 1430e35..2fcc9ad 100644 --- a/interfaces/ImsdMessages.Ui-App.cppm +++ b/interfaces/ImsdMessages.Ui-App.cppm @@ -91,10 +91,18 @@ export namespace ImsdMessages::Ui { static gboolean OnScreenshot(gpointer data) { App& self = *static_cast(data); if (self.canvas) { - self.canvas->Window().Update(); - self.canvas->Window().SaveFrame(self.screenshotPath); - self.Log(std::format("screenshot written to {} ({}x{} px)", self.screenshotPath.string(), self.canvas->Window().width, self.canvas->Window().height)); - self.exitCode = 0; // a failure until written (main) + try { + self.canvas->Window().CaptureNextFrame(self.screenshotPath); + self.canvas->Window().Update(); + self.Log(std::format("screenshot written to {} ({}x{} px)", self.screenshotPath.string(), self.canvas->Window().width, self.canvas->Window().height)); + self.exitCode = 0; // a failure until written (main) + } catch (const std::exception& e) { + // The library throws when the capture fails (a Vulkan call, + // the PNG's write): the bench learns it from the log and the + // exit status. + self.Log(std::format("screenshot not written to {}: {}", self.screenshotPath.string(), e.what())); + self.exitCode = 1; + } } else { // No window to render it — none could be made, or it went // between the request and the capture: logged, and the run diff --git a/project.cpp b/project.cpp index 9391694..ba3891a 100644 --- a/project.cpp +++ b/project.cpp @@ -67,21 +67,21 @@ static void ApplyGioFlags(Configuration& cfg, const GioFlags& f) { } extern "C" Configuration CrafterBuildProject(std::span args) { - // --local builds Crafter.DB from the sibling checkout under ~/repos/Crafter - // instead of the forge, for work on both sides at once. The flag is this - // project's: it is removed before the arguments are forwarded, so a + // Crafter.DB and Crafter.Graphics come from the forge at the commits + // pinned below; --local builds them from the sibling checkouts in + // ../Crafter/ instead, for work on both sides at once. The flag is + // this project's: it is removed before the arguments are forwarded, so a // dependency's project.cpp never sees it. std::vector depArgs(args.begin(), args.end()); const bool local = std::erase(depArgs, "--local") > 0; Configuration* db = local ? LocalProject({ .projectFile = "../Crafter/Crafter.DB/project.cpp", .args = depArgs }) - : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.DB.git" }, .args = depArgs }); - // The window library. --local takes the branch worktree with the Wayland - // input work until it is merged. + : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.DB.git", .commit = "bfd0cc261bb39dc6812bb9c0ef407c919e7cc258" }, .args = depArgs }); + // The window library. Configuration* graphics = local - ? LocalProject({ .projectFile = "../Crafter/Crafter.Graphics-imsd-messages/project.cpp", .args = depArgs }) - : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Graphics.git" }, .args = depArgs }); + ? LocalProject({ .projectFile = "../Crafter/Crafter.Graphics/project.cpp", .args = depArgs }) + : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Graphics.git", .commit = "079b6b0e1fa5ae5267086e61b0658b1c2704d14e" }, .args = depArgs }); // imsd-messages-core — numbers, time, the model, word wrap, gestures, // the message field's editing, the store and the sync logic: std +