Craft Anything: understand how any software works, and craft your own.
Rust
Say the next start draws differently only when the window was never shown (#1071)
Joseph4eb8ec35c2a2
diff --git a/apps/craft-anything/src/main.rs b/apps/craft-anything/src/main.rsindex af88bfcb..7678327d 100644--- a/apps/craft-anything/src/main.rs+++ b/apps/craft-anything/src/main.rs@@ -146,7 +146,7 @@ fn main() -> eframe::Result {// Without a window the app would just vanish (#166): say why, and where the log is.let log = craft_anything_engine::settings::config_dir().join("desktop.log");#[cfg(windows)]- let retry = renderer.map(|r| format!(" The next start will draw with {}.", renderer::choose(Some(r), true).title())).unwrap_or_default();+ let retry = next_start_note(renderer, shown.load(std::sync::atomic::Ordering::Relaxed));#[cfg(not(windows))]let retry = String::new();let _ = rfd::MessageDialog::new()@@ -179,6 +179,17 @@ fn wants_software(setting: Option<&str>) -> bool {setting.is_some_and(|s| s.trim().eq_ignore_ascii_case("software"))}+/// What the error dialog says the next start will do. Only a start whose window was never shown+/// leaves its mark, so only then does the next start move on to another renderer; after the window+/// was shown the next start draws as this one did, and the dialog says nothing about it.+#[cfg(windows)]+fn next_start_note(renderer: Option<renderer::Renderer>, shown: bool) -> String {+ match renderer {+ Some(r) if !shown => format!(" The next start will draw with {}.", renderer::choose(Some(r), true).title()),+ _ => String::new(),+ }+}+/// The result of a run that may have panicked. A panic before the window's first frames were shown/// becomes an error, which the start-failure dialog then reports: on eframe 0.36 that is how wgpu/// reports a surface it can't configure (no usable GPU, or no desktop). It can also be any other bug@@ -468,4 +479,15 @@ mod graphics_tests {fn wants_software_reads_the_setting() {assert!(wants_software(Some(" Software ")) && !wants_software(Some("gpu")) && !wants_software(None));}++ /// #909 review: only a start whose window never showed moves on to another renderer, so only+ /// then does the dialog say the next start will draw differently.+ #[cfg(windows)]+ #[test]+ fn the_dialog_promises_another_renderer_only_before_the_window_was_shown() {+ use renderer::Renderer;+ assert_eq!(next_start_note(Some(Renderer::Dx12), false), " The next start will draw with Windows' software renderer.");+ assert_eq!(next_start_note(Some(Renderer::Dx12), true), "");+ assert_eq!(next_start_note(None, false), "", "a renderer from the environment is never changed");+ }}diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex 638cd6be..6ac8126f 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -155,6 +155,9 @@ cheapest help we can give anyone, so nothing below should hold it up for long.— claimed: 00xJS, branch bugfix/r5.1-renderer-fallback- [ ] Live-check #794's fallback on a machine where DX12 refuses `egui_pipeline` (the reporter's780M, or lightcraft#812's)+- [x] A window that fails after it was shown no longer says "The next start will draw with …": its+ start mark is already gone, so the next start draws as before (#909 review); the dialog says+ it only when the window was never shown (`next_start_note`) — claimed: 00xJS, branch bugfix/r5.1-retry-text-after-shown- [ ] Add to `docs/releasing.md`: before publishing, a Deep build through Claude Code from thefinished package, on a Mac and on Windows. Starting the CLI from the package (#91) doesn'tshow whether Claude Code accepts its tools — PR #982; claimed: doubektomas,