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.
This commit is contained in:
Jorijn van der Graaf 2026-10-20 23:15:25 +02:00
commit e413632668
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
3 changed files with 24 additions and 12 deletions

View file

@ -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

View file

@ -91,10 +91,18 @@ export namespace ImsdMessages::Ui {
static gboolean OnScreenshot(gpointer data) {
App& self = *static_cast<App*>(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

View file

@ -67,21 +67,21 @@ static void ApplyGioFlags(Configuration& cfg, const GioFlags& f) {
}
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> 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<std::string> 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 +