Refactor KeyCode into Key and Location

This commit is contained in:
Héctor Ramón Jiménez 2024-01-16 13:28:00 +01:00
parent 534c7dd7b0
commit 64d1ce5532
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
24 changed files with 1277 additions and 461 deletions

View file

@ -1,4 +1,4 @@
use super::{KeyCode, Modifiers};
use crate::keyboard::{Key, Location, Modifiers};
/// A keyboard event.
///
@ -10,10 +10,13 @@ use super::{KeyCode, Modifiers};
pub enum Event {
/// A keyboard key was pressed.
KeyPressed {
/// The key identifier
key_code: KeyCode,
/// The key pressed.
key: Key,
/// The state of the modifier keys
/// The location of the key.
location: Location,
/// The state of the modifier keys.
modifiers: Modifiers,
/// The text produced by the key press, if any.
@ -22,10 +25,13 @@ pub enum Event {
/// A keyboard key was released.
KeyReleased {
/// The key identifier
key_code: KeyCode,
/// The key released.
key: Key,
/// The state of the modifier keys
/// The location of the key.
location: Location,
/// The state of the modifier keys.
modifiers: Modifiers,
},