layout: Improve press handling

Makes it more similar to release handling, removes some redundant checks.

This makes it easier to integrate modifiers in the future.
This commit is contained in:
Dorota Czaplejewicz
2020-02-05 12:25:46 +00:00
parent da1f480f7a
commit cb802cfb50
3 changed files with 89 additions and 44 deletions

View File

@ -46,6 +46,14 @@ impl KeyState {
}
}
#[must_use]
pub fn into_pressed(self) -> KeyState {
KeyState {
pressed: PressType::Pressed,
..self
}
}
/// KeyStates instances are the unique identifiers of pressed keys,
/// and the actions submitted with them.
pub fn get_id(keystate: &Rc<RefCell<KeyState>>) -> KeyStateId {