Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Update prompt shows the app icon and accent color instead of a letter (#4671)

Dylan M. Taylora24d811c7b72
diff --git a/Cargo.lock b/Cargo.lock
index 9627beff9..e8aa942df 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1047,13 +1047,14 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
-source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
+source = "git+https://github.com/storytold/craft-libs?rev=1065653e75854e9c17e1ff563acdd344c1b185f0#1065653e75854e9c17e1ff563acdd344c1b185f0"
dependencies = [
"chrono",
"dunce",
"egui",
"flate2",
"getrandom 0.3.4",
+ "image",
"log",
"plist",
"semver",
diff --git a/Cargo.toml b/Cargo.toml
index c134a3c19..28cd269e9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,8 @@ craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "92d392c
# Decides who draws the window frame (desktop vs. app) so the suite shares one native titlebar per
# desktop. The `egui` feature adds `craft_window::decorate`. (craft-libs#217.)
craft-window = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] }
-craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] }
+# craft-update with storytold/craft-libs#434: the update prompt shows the app's icon, accent and developer.
+craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1065653e75854e9c17e1ff563acdd344c1b185f0", features = ["egui"] }
# internal
vectorcraft-geom = { path = "crates/geom" }
vectorcraft-color = { path = "crates/color" }
diff --git a/apps/vectorcraft/src/main.rs b/apps/vectorcraft/src/main.rs
index f02cbda18..e90977726 100644
--- a/apps/vectorcraft/src/main.rs
+++ b/apps/vectorcraft/src/main.rs
@@ -128,7 +128,7 @@ Without a window (converting, scripting, the MCP server), use vectorcraft-cli:
fn main() -> std::process::ExitCode {
// Windows: the update helper is a copy of this program started with `--finish-update`.
#[cfg(windows)]
- if let Some(result) = craft_update::self_update::finish(&craft_update::suite::VECTORCRAFT, &std::env::args_os().skip(1).collect::<Vec<_>>()) {
+ if let Some(result) = craft_update::self_update::finish(&vectorcraft_ui_egui::UPDATE_APP, &std::env::args_os().skip(1).collect::<Vec<_>>()) {
std::process::exit(i32::from(result.is_err()));
}
// Before any thread starts: the pointer must find a cursor theme on Wayland (#2450).
diff --git a/crates/svg/src/import/fx.rs b/crates/svg/src/import/fx.rs
index 89fa0d0dd..8c809f0cd 100644
--- a/crates/svg/src/import/fx.rs
+++ b/crates/svg/src/import/fx.rs
@@ -362,9 +362,7 @@ pub(super) fn effects(filters: &[Arc<Filter>], ts: Affine, blends: &HashMap<Stri
}
// A fixed subtraction before blur maps to Darkness; proportional intermediate
// color filters must not be reinterpreted as a different-looking effect.
- [V::Shade { sd, linear, dx, dy, keep, subtract, opacity }, V::Graphic]
- if (!*linear || *keep == 0.0) && (*keep == 0.0 || *keep == 1.0) =>
- {
+ [V::Shade { sd, linear, dx, dy, keep, subtract, opacity }, V::Graphic] if *keep == 0.0 || !*linear && *keep == 1.0 => {
let v = along(*dx, *dy);
let (darkness, opacity) = (num(if *keep == 0.0 { 100.0 } else { *subtract as f64 * 100.0 }), num(*opacity as f64 * 100.0));
let p = json!({ "x": num(v.x), "y": num(v.y), "blur": blur(*sd), "shade": "darkness", "darkness": darkness, "opacity": opacity, "mode": mode });
diff --git a/crates/tools/src/text/tool.rs b/crates/tools/src/text/tool.rs
index 5307d6175..cef7f4a9b 100644
--- a/crates/tools/src/text/tool.rs
+++ b/crates/tools/src/text/tool.rs
@@ -145,7 +145,7 @@ impl Tool for TypeTool {
return false;
}
let clip: String = self.clipboard.iter().map(|r| r.text.as_str()).collect();
- !(self.preedit.is_none() && !normalized.is_empty() && normalized == clip && !cx.paste_plain_text)
+ self.preedit.is_some() || normalized.is_empty() || normalized != clip || cx.paste_plain_text
}
/// Whether the typing session still describes the edited document; a session ended by an outside
/// command reports false until a replacement commit starts a new one.
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 305364639..fe7b87c36 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -5,6 +5,15 @@
//! shortcuts, the ⌘K palette and the control channel ([`control`]).
#![forbid(unsafe_code)]
+/// VectorCraft as craft-update knows it, with its 128 px icon and accent colour: the update
+/// prompt shows both, and an AppImage's menu entry gets the icon.
+#[cfg(not(target_arch = "wasm32"))]
+pub const UPDATE_APP: craft_update::app::App = craft_update::app::App {
+ icon_png: Some(include_bytes!("../../../assets/app-icon/hicolor/128x128/apps/ai.storyteller.vectorcraft.png")),
+ accent: Some([0xe8, 0x57, 0x3f]),
+ ..craft_update::suite::VECTORCRAFT
+};
+
/// Translate a UI string literal into the language the UI is drawn in (see [`i18n`]).
#[macro_export]
macro_rules! tl {
diff --git a/crates/ui-egui/src/updates_ui.rs b/crates/ui-egui/src/updates_ui.rs
index 88e6b84a6..ee9d09b71 100644
--- a/crates/ui-egui/src/updates_ui.rs
+++ b/crates/ui-egui/src/updates_ui.rs
@@ -26,7 +26,7 @@ impl Default for Runtime {
fn default() -> Self {
Self {
#[cfg(not(target_arch = "wasm32"))]
- updater: Updater::new(&craft_update::suite::VECTORCRAFT, env!("CARGO_PKG_VERSION")),
+ updater: Updater::new(&crate::UPDATE_APP, env!("CARGO_PKG_VERSION")),
#[cfg(not(target_arch = "wasm32"))]
startup_check: false,
#[cfg(not(target_arch = "wasm32"))]