bevyengine / bevyengine/bevy

Key release not detected on window mode change

Open
#8,391 8 comments 1 reaction 0 assignees View on GitHub
A-Input A-Windowing C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

Bevy 0.10.1

## System information

MacOS

## What you did

Used the following system to swap the window mode by pressing the 'A' key.

```rust
fn toggle_window_explicit(
keyboard_input: Res>,
mut window: Query<&mut Window, With>,
) {
if !keyboard_input.just_pressed(KeyCode::A) { return }

let window: &mut Window = &mut window.single_mut();
if window.mode == bevy::window::WindowMode::Windowed
{ window.mode = bevy::window::WindowMode::SizedFullscreen; }
else
{ window.mode = bevy::window::WindowMode::Windowed; }
}
```

## What went wrong

Toggling the window mode takes two key presses unless you hold the key down until the window transition is complete. Key releases are not detected if they occur during the transition.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.