mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 21:30:03 -04:00
Revise Key and KeyCode enums
Split `Key` into clear categories, like `Named`, `Dead`, Character`, `Unidentified` removing the `#[non_exhaustive]` from the `Key` itself. Similar action was done for the `KeyCode`. Fixes: #2995 Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
committed by
Kirill Chibisov
parent
18b8569161
commit
6b445219c1
@@ -3,7 +3,7 @@
|
||||
use winit::{
|
||||
event::{ElementState, Event, KeyEvent, WindowEvent},
|
||||
event_loop::EventLoop,
|
||||
keyboard::KeyCode,
|
||||
keyboard::Key,
|
||||
window::{Fullscreen, WindowBuilder},
|
||||
};
|
||||
|
||||
@@ -39,13 +39,13 @@ pub fn main() -> Result<(), impl std::error::Error> {
|
||||
WindowEvent::KeyboardInput {
|
||||
event:
|
||||
KeyEvent {
|
||||
physical_key: KeyCode::KeyF,
|
||||
logical_key: Key::Character(c),
|
||||
state: ElementState::Released,
|
||||
..
|
||||
},
|
||||
..
|
||||
},
|
||||
} if window_id == window.id() => {
|
||||
} if window_id == window.id() && c == "f" => {
|
||||
if window.fullscreen().is_some() {
|
||||
window.set_fullscreen(None);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user