bevyengine / bevyengine/bevy

keyboard events sometimes will not work

Open
#12,150 6 comments 0 reactions 0 assignees View on GitHub
A-Input C-Bug I-Regression S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

this started happening in 0.13
but still an issue as of 80208058304df9

## \[Optional\] Relevant system information

- rust: stable, cargo 1.76.0 (c84b36747 2024-01-18)
- system: void linux x86_64 xfce 4.18 (x11)
- kernel: 6.6.16_1

just in case:
```ignore
AdapterInfo { name: "Intel(R) UHD Graphics (TGL GT2)", vendor: 32902, device: 39544, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 23.3.5", backend: Vulkan }
```

## What you did

running either of those examples:
```
cargo r --release --example keyboard_input_events
```
or
```
cargo r --release --example char_input_events
```

edit: same with the `keyboard_input` example
## What went wrong

- what were you expecting?
when compiling is done the game window is spawned and has focus and any keyboard input to it is printed in the terminal
- what actually happened?
sometimes that doesn't work until the window loses focus and then regains focus. most times this doesn't happen, but every few runs it does. this has never happened in 0.12.
also clicking inside the window doesn't help when it's in this state
## Additional information
it happens around 1:15

https://github.com/bevyengine/bevy/assets/86204514/5322ae12-5499-4105-8c9e-a01faabeffd5

- theories about what might be going wrong
- winit stuff? xD
- workarounds that you ~~used~~ tried
- i've tried messing with `ime_enabled` and `focused` in my window, and also starting the window in fullscreen mode, but nothing fixed this

Contributor guide

Open the contributing guide

Research direction

Start by running the mentioned keyboard_input_events, char_input_events, and keyboard_input examples and observe whether keyboard input is missing until focus changes. Compare the behavior with the reported 0.12 difference and inspect the window/input handling path implicated by the winit theory. Done means reliably reproducing the intermittent state and correcting it so a newly focused window receives keyboard input consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.