bevy/crates/bevy_window/src
Antony 74ccab947d
Remove ReceivedCharacter (#15126)
# Objective

- Fixes #12639.
- `ReceivedCharacter` was deprecated in #12868 for 0.14, and should be
removed for 0.15.

## Solution

- Remove all instances of `ReceivedCharacter`, including the relevant
`#[allow(deprecated)]` lint attributes.

## Migration Guide

`ReceivedCharacter` was deprecated in 0.14 due to `winit` reworking
their keyboard system. It has now been fully removed. Switch to using
`KeyboardInput` instead.

```rust
// 0.14
fn listen_characters(events: EventReader<ReceivedCharacter>) {
    for event in events.read() {
        info!("{}", event.char);
    }
}

// 0.15
fn listen_characters(events: EventReader<KeyboardInput>) {
    for event in events.read() {
        // Only check for characters when the key is pressed.
        if !event.state.is_pressed() {
            continue;
        }

        // Note that some keys such as `Space` and `Tab` won't be detected as a character.
        // Instead, check for them as separate enum variants.
        match &event.logical_key {
            Key::Character(character) => {
                info!("{} pressed.", character);
            },
            Key::Space => {
                info!("Space pressed.");
            },
            _ => {},
        }
    }
}
```
2024-09-10 00:22:06 +00:00
..
event.rs Remove ReceivedCharacter (#15126) 2024-09-10 00:22:06 +00:00
lib.rs Remove ReceivedCharacter (#15126) 2024-09-10 00:22:06 +00:00
monitor.rs Expose winit's MonitorHandle (#13669) 2024-08-06 10:54:37 +00:00
raw_handle.rs fix: upgrade to winit v0.30 (#13366) 2024-06-03 13:06:48 +00:00
system.rs Properly handle repeated window close requests (#14573) 2024-08-01 16:15:28 +00:00
system_cursor.rs Add custom cursors (#14284) 2024-08-12 15:49:03 +00:00
window.rs Remove ReceivedCharacter (#15126) 2024-09-10 00:22:06 +00:00