From 83e61c6fb064591e5cacb655156621f7eeafacc8 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 19 Jan 2026 09:01:11 +0100 Subject: [PATCH 1/3] Improve docs of key/button "down" state (#7851) --- crates/egui/src/input_state/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/input_state/mod.rs b/crates/egui/src/input_state/mod.rs index 49027c06e..37faf64c2 100644 --- a/crates/egui/src/input_state/mod.rs +++ b/crates/egui/src/input_state/mod.rs @@ -319,7 +319,9 @@ pub struct InputState { /// Which modifier keys are down at the start of the frame? pub modifiers: Modifiers, - // The keys that are currently being held down. + /// The keys that are currently being held down. + /// + /// Keys released this frame are NOT considered down. pub keys_down: HashSet, /// In-order events received this frame @@ -765,6 +767,8 @@ impl InputState { } /// Is the given key currently held down? + /// + /// Keys released this frame are NOT considered down. pub fn key_down(&self, desired_key: Key) -> bool { self.keys_down.contains(&desired_key) } @@ -1018,6 +1022,7 @@ pub struct PointerState { /// Used for calculating velocity of pointer. pos_history: History, + /// Buttons currently down, excluding those released this frame. down: [bool; NUM_POINTER_BUTTONS], /// Where did the current click/drag originate? @@ -1405,6 +1410,8 @@ impl PointerState { } /// Is any pointer button currently down? + /// + /// Buttons released this frame are NOT considered down. pub fn any_down(&self) -> bool { self.down.iter().any(|&down| down) } @@ -1460,6 +1467,8 @@ impl PointerState { } /// Is this button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn button_down(&self, button: PointerButton) -> bool { self.down[button as usize] @@ -1516,18 +1525,24 @@ impl PointerState { } /// Is the primary button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn primary_down(&self) -> bool { self.button_down(PointerButton::Primary) } /// Is the secondary button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn secondary_down(&self) -> bool { self.button_down(PointerButton::Secondary) } /// Is the middle button currently down? + /// + /// Buttons released this frame are NOT considered down. #[inline(always)] pub fn middle_down(&self) -> bool { self.button_down(PointerButton::Middle) From fa78d25564a5dbcb546ff6db0a9e14cb603ba03b Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Mon, 19 Jan 2026 10:47:10 -0300 Subject: [PATCH 2/3] egui_kittest: Close debug_open_snapshot temp file before viewing it (#7841) The image file written by debug_open_snapshot was being kept open by the `tempfile` object. On Windows, this prevented `open::that` from successfully launching the viewer sometimes because the file remained locked, which can be avoided by first releasing the file handle. --- crates/egui_kittest/src/snapshot.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/egui_kittest/src/snapshot.rs b/crates/egui_kittest/src/snapshot.rs index 4d139fcbb..8134dbdf0 100644 --- a/crates/egui_kittest/src/snapshot.rs +++ b/crates/egui_kittest/src/snapshot.rs @@ -721,11 +721,14 @@ impl Harness<'_, State> { }) .unwrap(); + // Close temp file so it isn't locked when `open` tries to launch it (on Windows) + let path = temp_file.into_temp_path(); + #[expect(clippy::print_stdout)] { println!("Wrote debug snapshot to: {}", path.display()); } - let result = open::that(path); + let result = open::that(&path); if let Err(err) = result { #[expect(clippy::print_stderr)] { From cf282702d4a5548431d7ffaf1d1c9b2e2ea1e080 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Tue, 27 Jan 2026 02:23:15 +0100 Subject: [PATCH 3/3] update snapshot --- .../egui_kittest/tests/snapshots/should_wait_for_images.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png index be474dfc3..54c0f9d76 100644 --- a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png +++ b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c419519f1cddb37c54e30071a3a9519106807e8ae3fe812649c12ee5a1b7c5db -size 2729 +oid sha256:845acb34152fb829dc24c606b1741e250f1d1fa645236ef57fce0cbda104c465 +size 2121