PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge PR #7849: Menu bar: a held Alt's auto-repeat doesn't re-arm the Alt tap
David Mann0fcdd660cb82
diff --cc crates/ui-egui/src/menu_keys.rsindex 83d8d2dbb,cb0b2b84d..20eed5b1f--- a/crates/ui-egui/src/menu_keys.rs+++ b/crates/ui-egui/src/menu_keys.rs@@@ -289,18 -208,15 +289,22 @@@ impl Keys}let events = ctx.input(|i| i.events.clone());let mut tap = false;- for e in &events {+ // The tap is judged on every event of the frame, also those another handler consumed+ // before the bar's turn: the shortcuts run first, so Ctrl+Alt+I (Image Size) left no+ // trace in `events`, and releasing Alt counted as a tap that put the keyboard on the bar;+ // Enter then opened File instead of confirming the dialog (#7481).+ let raw = ctx.input(|i| i.raw.events.clone());+ for e in &raw {match e {+ // A held Alt auto-repeats (after about half a second on Windows): only its first+ // press starts a tap. A repeat must neither re-arm a tap that Alt+wheel or a key+ // already spent, nor spend one itself (holding Alt alone is still a tap).+ Event::Key { key: Key::AltLeft | Key::AltRight, pressed: true, repeat: true, .. } => self.alt_down = true,Event::Key { key: Key::AltLeft | Key::AltRight, pressed: true, .. } => {self.alt_down = true;- self.alt_tap = true;+ // Alt pressed while a mouse button is down is a modifier for that drag+ // (Free Transform's scale-from-centre), never a tap (#8113).+ self.alt_tap = self.buttons_held == 0;}Event::Key { key: Key::AltLeft | Key::AltRight, pressed: false, .. } => {self.alt_down = false;