DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Docking: pin craft-libs to pin-round3 d24e4bcce; craft-ui focuses the main window for a modal
aionggd9f96f6cbb48
diff --git a/Cargo.lock b/Cargo.lockindex e72a48297..7cbced543 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -954,7 +954,7 @@ dependencies = [[[package]]name = "craft-atomic"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["rustix 1.1.5",]@@ -962,7 +962,7 @@ dependencies = [[[package]]name = "craft-cms"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["rayon",]@@ -970,12 +970,12 @@ dependencies = [[[package]]name = "craft-docpath"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"[[package]]name = "craft-pdf"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["bytemuck","hayro",@@ -988,7 +988,7 @@ dependencies = [[[package]]name = "craft-print"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["craft-winprint-gdi","miniz_oxide 0.8.9",@@ -1001,7 +1001,7 @@ dependencies = [[[package]]name = "craft-ui"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["egui","log",@@ -2458,7 +2458,7 @@ dependencies = [[[package]]name = "hayro"version = "0.7.1"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["bytemuck","hayro-interpret",@@ -2478,7 +2478,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"[[package]]name = "hayro-cmap"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["brotli","hayro-postscript",@@ -2487,7 +2487,7 @@ dependencies = [[[package]]name = "hayro-interpret"version = "0.7.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["bitflags 2.13.2","hayro-cmap",@@ -2505,7 +2505,7 @@ dependencies = [[[package]]name = "hayro-jbig2"version = "0.3.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["fearless_simd","hayro-ccitt",@@ -2523,12 +2523,12 @@ dependencies = [[[package]]name = "hayro-postscript"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"[[package]]name = "hayro-syntax"version = "0.7.2"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["flate2","hayro-ccitt",@@ -3029,7 +3029,7 @@ dependencies = [[[package]]name = "krilla"version = "0.8.2"-source = "git+https://github.com/storytold/craft-libs?rev=cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f#cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f"+source = "git+https://github.com/storytold/craft-libs?rev=d24e4bcce3b420f25b7bca2b2d786cbcc8631f96#d24e4bcce3b420f25b7bca2b2d786cbcc8631f96"dependencies = ["base64 0.22.1","bumpalo",diff --git a/Cargo.toml b/Cargo.tomlindex 93adb6ced..b6e126a6c 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -12,7 +12,7 @@ repository = "https://github.com/storytold/designcraft"[workspace.dependencies]# Shared reader and writer; publish the immutable revision before this consumer.-craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.1.0", default-features = false }+craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.1.0", default-features = false }# internaldesigncraft-geom = { path = "crates/geom" }designcraft-color = { path = "crates/color" }@@ -75,18 +75,18 @@ zip = { version = "3", default-features = false, features = ["deflate"] }indd = { git = "https://github.com/storytold/indd-utils", branch = "main" }# Which paths stored in documents may be followed (craft-libs).-craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f" }+craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96" }# Atomic file replacement for saves and exports (craft-libs).-craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f" }+craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96" }# File › Print through the system print spooler (craft-libs).-craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f" }+craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96" }# ICC colour management: working spaces, transforms, black point compensation (craft-libs).-craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f" }+craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96" }# ui# Shared frontend components; keep this dependency above the engine boundary.-craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", features = ["serde"] }+craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", features = ["serde"] }egui = "0.36"egui_extras = { version = "0.36", default-features = false, features = ["svg"] }eframe = { version = "0.36", default-features = false }@@ -122,11 +122,11 @@ debug = 0# Opt-in cancelable macOS termination on the pinned winit 0.30 line.[patch.crates-io]-krilla = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.8.2" }+krilla = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.8.2" }winit = { git = "https://github.com/storytold/winit.git", rev = "3d51077fd1a966f84df9ef287839dc84fd5b4ca7" }-hayro = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.7.1" }-hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.7.0" }-hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.7.2" }-hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.3.0" }-hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.1.0" }-hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f", version = "=0.1.0" }+hayro = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.7.1" }+hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.7.0" }+hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.7.2" }+hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.3.0" }+hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.1.0" }+hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96", version = "=0.1.0" }diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rsindex a0a3f8854..52dd988ff 100644--- a/crates/ui-egui/src/panel_docking.rs+++ b/crates/ui-egui/src/panel_docking.rs@@ -1043,16 +1043,6 @@ pub(crate) fn show(app: &mut DesignApp, ui: &mut egui::Ui) {let raise = app.ui.docking_raise.take();let mut blocked = Vec::new();let modal = modal_open(app);- // A modal opened from a floating panel's window (a double-click, a shortcut typed there)- // leaves the OS keyboard focus on that window, which takes no input while the modal is open.- let was_open_id = egui::Id::new("modal-was-open");- let was_open = ui.ctx().data(|d| d.get_temp::<bool>(was_open_id)).unwrap_or(false);- ui.ctx().data_mut(|d| d.insert_temp(was_open_id, modal));- let floats = native_viewports(app, ui.ctx());- let float_focused = ui.ctx().input(|i| floats.iter().any(|v| i.raw.viewports.get(v).and_then(|v| v.focused) == Some(true)));- if focus_main_for_modal(was_open, modal, float_focused) {- ui.ctx().send_viewport_cmd_to(egui::ViewportId::ROOT, egui::ViewportCommand::Focus);- }if modal || egui::Popup::is_any_open(ui.ctx()) {blocked.push(ui.ctx().content_rect());} else if crate::story_editor::visible(app) {@@ -1117,13 +1107,6 @@ pub(crate) fn modal_open(app: &DesignApp) -> bool {app.ui.dialog.is_some() || app.ui.about || app.ui.palette.is_some()}-/// Whether to focus the main window: on the frame a modal opens (`was_open` false, `open`-/// true) while one of the floating panels' own windows has the keyboard. With the app in the-/// background nothing is focused, so a modal that opens on its own doesn't pull the app forward.-pub(crate) fn focus_main_for_modal(was_open: bool, open: bool, float_focused: bool) -> bool {- open && !was_open && float_focused-}-/// What the control channel reports: the layout in use (craft-ui's serialized `Layout`),/// whether it is the workspace's default, the panel (or `canvas`) last clicked or selected, the/// panels closed with a remembered place, the panel whose flyout is open, and where eachdiff --git a/crates/ui-egui/src/panel_docking_tests.rs b/crates/ui-egui/src/panel_docking_tests.rsindex 3b4f863cc..23f79cd5c 100644--- a/crates/ui-egui/src/panel_docking_tests.rs+++ b/crates/ui-egui/src/panel_docking_tests.rs@@ -1276,13 +1276,3 @@ fn a_document_dropped_on_a_floating_panel_window_opens() {assert_eq!(app.session.documents().len(), 1, "the dropped document opens");}-/// A modal that opens while a floating panel's own window has the keyboard brings the main-/// window to the front, so the modal gets the keys. Once open, with the main window focused or-/// with the app in the background (no float focused), nothing is sent.-#[test]-fn a_modal_opening_from_a_floating_window_focuses_the_main_window() {- assert!(focus_main_for_modal(false, true, true));- assert!(!focus_main_for_modal(false, true, false), "main window focused, or the app in the background");- assert!(!focus_main_for_modal(true, true, true), "only on the frame it opens");- assert!(!focus_main_for_modal(false, false, true));-}diff --git a/docs/pdf-backend.md b/docs/pdf-backend.mdindex 1faac5113..9dd4b0b0b 100644--- a/docs/pdf-backend.md+++ b/docs/pdf-backend.md@@ -1,7 +1,7 @@# Shared PDF backendDesignCraft pins `craft-pdf`, patched Krilla 0.8.2 and the six Hayro reader crates (with-`hayro-cmap` and `hayro-postscript`) to craft-libs revision `cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f`. `craft-ui`,+`hayro-cmap` and `hayro-postscript`) to craft-libs revision `d24e4bcce3b420f25b7bca2b2d786cbcc8631f96`. `craft-ui`,`craft-print` and the other craft-libs crates are pinned to the same revision. The reader migration is reviewed on top of the separate writer change.## Writingdiff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rsindex 29d416eca..f6d4f9bf9 100644--- a/xtask/src/pdf_deps.rs+++ b/xtask/src/pdf_deps.rs@@ -4,7 +4,7 @@ use std::process::Command;use serde_json::Value;-const REV: &str = "cdc6713130b2dfe3cdddeb3a9cd71deeb94ed65f";+const REV: &str = "d24e4bcce3b420f25b7bca2b2d786cbcc8631f96";const PACKAGES: &[(&str, &str)] = &[("craft-pdf", "0.1.0"),("krilla", "0.8.2"),