DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Integration: winit from main's fork, with the macOS Dock Quit opt-in
aiongg5639ba820307
diff --git a/Cargo.lock b/Cargo.lockindex a98280ec3..bc2369d12 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1320,11 +1320,6 @@ version = "1.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"-[[package]]-name = "dpi"-version = "0.1.1"-source = "git+https://github.com/rust-windowing/winit?rev=39c4009c41e5977d779cf8a365792c8153ca77c5#39c4009c41e5977d779cf8a365792c8153ca77c5"-[[package]]name = "dpi"version = "0.1.2"@@ -2748,7 +2743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c6744ab645ebe79f9c428455c7cb9dfa4275fa3b50a25408e08f927da8dc618c"dependencies = ["crossbeam-channel",- "dpi 0.1.2",+ "dpi","keyboard-types","objc2 0.6.4","objc2-app-kit 0.3.2",@@ -5619,7 +5614,7 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"[[package]]name = "winit"version = "0.30.13"-source = "git+https://github.com/rust-windowing/winit?rev=39c4009c41e5977d779cf8a365792c8153ca77c5#39c4009c41e5977d779cf8a365792c8153ca77c5"+source = "git+https://github.com/skylartaylor/winit.git?rev=3d51077fd1a966f84df9ef287839dc84fd5b4ca7#3d51077fd1a966f84df9ef287839dc84fd5b4ca7"dependencies = ["ahash","android-activity",@@ -5633,7 +5628,7 @@ dependencies = ["core-foundation","core-graphics","cursor-icon",- "dpi 0.1.1",+ "dpi","js-sys","libc","memmap2",diff --git a/Cargo.toml b/Cargo.tomlindex 7665ee5dd..a9aeccd3e 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -112,15 +112,9 @@ lto = "thin"codegen-units = 16debug = 0-# Windows 11: winit 0.30.13 resizes a window wrongly while it is dragged across monitors with-# different display scales (rust-windowing/winit#4041, #4600). It flips between the two scales,-# grows by the scale ratio (3600×2250 → 9048×5757 between 250 % and 100 %) and outgrows the GPU-# surface. Pinned to the one commit of rust-windowing/winit#4694, the 0.30.x backport of the fix-# winit master has had since 488c036a (#4341): during a live drag it applies the rect Windows-# suggests (+21/−34 lines in src/platform_impl/windows/event_loop.rs on top of v0.30.13). Remove-# once eframe depends on a winit release with the fix.+# Opt-in cancelable macOS termination on the pinned winit 0.30 line.[patch.crates-io]-winit = { git = "https://github.com/rust-windowing/winit", rev = "39c4009c41e5977d779cf8a365792c8153ca77c5" }+winit = { git = "https://github.com/skylartaylor/winit.git", rev = "3d51077fd1a966f84df9ef287839dc84fd5b4ca7" }krilla = { git = "https://github.com/storytold/craft-libs", rev = "c3487320b2d1de657b860b3c8abb44e1f2b32bd8", version = "=0.8.2" }# The hayro crates from pdfcraft's vendor/ directory, with the patches its README lists.hayro = { git = "https://github.com/storytold/pdfcraft", rev = "b5467d93a0ffaa5e5e6658bccdf8655a3ba689c9" }diff --git a/apps/designcraft/Cargo.toml b/apps/designcraft/Cargo.tomlindex 03dbfc445..7dc83bc55 100644--- a/apps/designcraft/Cargo.toml+++ b/apps/designcraft/Cargo.toml@@ -38,6 +38,8 @@ winit = { version = "0.30", default-features = false, features = ["x11"] }winsafe = { version = "0.0.29", default-features = false, features = ["user"] }[target.'cfg(target_os = "macos")'.dependencies]+# The same winit as eframe; only the native termination opt-in is used.+winit = { version = "0.30", default-features = false }muda = { version = "0.21", default-features = false }# The input context, to drop the IME's marked text when the Type tool ends a composition; the# window's `movable` flag (see `mac_window`). The versions muda uses, through safe methods.diff --git a/apps/designcraft/src/main.rs b/apps/designcraft/src/main.rsindex 287a2866c..a1b4d8276 100644--- a/apps/designcraft/src/main.rs+++ b/apps/designcraft/src/main.rs@@ -438,6 +438,15 @@ fn main() -> std::process::ExitCode {b.with_x11();}));}+ // AppKit Dock Quit otherwise terminates before egui can cancel the close. Route it through+ // ordinary CloseRequested events, preserving the same transactional Save/Don't Save flow.+ #[cfg(target_os = "macos")]+ {+ options.event_loop_builder = Some(Box::new(|builder| {+ use winit::platform::macos::EventLoopBuilderExtMacOS;+ builder.with_close_requested_on_terminate(true);+ }));+ }// Registered before the event loop starts, so it catches the Finder event that launched the app// as well as later ones. Lives until the event loop returns; the app creator only borrows it.#[cfg(target_os = "macos")]