bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Expose Winit's `KeyEvent::repeat` in `KeyboardInput`

Open daxpedda opened this issue 1 year ago • 2 comments

Objective

I would like to know if an event was emitted because of "key repeats" or not. Winit already exposes this information, but it isn't sent along by Bevy, which this PR intends to address.

Solution

Expose winit::event::KeyEvent::repeat in bevy::input::keyboard::KeyboardInput.

Testing

Just hold any regular key down and only the first event should have KeyboardInput::repeat set to false. Most OSs have "key repeat" enabled by default.


Changelog

  • Added KeyboardInput::repeat signifying if this event was sent in response to a "key repeat" event or not.

daxpedda avatar Jul 05 '24 17:07 daxpedda

AFAICS this change is additive so this:

Added KeyboardInput::repeat signifying if this event was sent in response to a "key repeat" event or not.

Could be moved to the Changelog section of the PR description and the Migration Guide removed.

Thanks for adding it!

mnmaita avatar Jul 05 '24 20:07 mnmaita

AFAICS this change is additive so this:

Added KeyboardInput::repeat signifying if this event was sent in response to a "key repeat" event or not.

Could be moved to the Changelog section of the PR description and the Migration Guide removed.

Ah, that was by mistake! Thanks!

daxpedda avatar Jul 06 '24 08:07 daxpedda