Merge pull request #2991 from bbb651/keyboard-event-repeat

Add `repeat` field to `keyboard::Event::KeyPressed`
This commit is contained in:
Héctor 2025-11-29 02:01:52 +01:00 committed by GitHub
commit 6aba73a13f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 0 deletions

View file

@ -29,6 +29,9 @@ pub enum Event {
/// The text produced by the key press, if any. /// The text produced by the key press, if any.
text: Option<SmolStr>, text: Option<SmolStr>,
/// Whether the event was the result of key repeat.
repeat: bool,
}, },
/// A keyboard key was released. /// A keyboard key was released.

View file

@ -381,6 +381,7 @@ pub fn press_key(
), ),
location: keyboard::Location::Standard, location: keyboard::Location::Standard,
modifiers: keyboard::Modifiers::default(), modifiers: keyboard::Modifiers::default(),
repeat: false,
text, text,
}) })
} }

View file

@ -249,6 +249,7 @@ pub fn window_event(
location, location,
logical_key, logical_key,
physical_key, physical_key,
repeat,
.. ..
} = event; } = event;
@ -279,6 +280,7 @@ pub fn window_event(
modifiers, modifiers,
location, location,
text, text,
repeat,
} }
} }
winit::event::ElementState::Released => { winit::event::ElementState::Released => {