Integration: winit from main's fork, with the macOS Dock Quit opt-in

The merge took next's winit patch (rust-windowing/winit#4694, the Windows mixed-DPI drag fix) and
left out main's (skylartaylor/winit 3d51077f, with_close_requested_on_terminate), so Quit from the
Dock stopped asking to save (#623, released in 0.8.0). Cargo takes one winit patch, so the batch
keeps main's until one fork holds both commits; the Windows fix (#631) follows then.
This commit is contained in:
aiongg
2026-10-16 03:57:21 +00:00
parent 2f017d0826
commit 5639ba8203
4 changed files with 16 additions and 16 deletions
Generated
+3 -8
View File
@@ -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",
+2 -8
View File
@@ -112,15 +112,9 @@ lto = "thin"
codegen-units = 16
debug = 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" }
+2
View File
@@ -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.
+9
View File
@@ -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")]