Merge branch 'lock' into 'master'

Turn locking stateless

See merge request Librem5/squeekboard!322
This commit is contained in:
Sebastian Krzyszkowiak
2020-02-05 09:25:49 +00:00
5 changed files with 43 additions and 35 deletions

View File

@ -31,7 +31,6 @@ pub struct KeyStateId(*const KeyState);
#[derive(Debug, Clone)]
pub struct KeyState {
pub pressed: PressType,
pub locked: bool,
/// A cache of raw keycodes derived from Action::Sumbit given a keymap
pub keycodes: Vec<KeyCode>,
/// Static description of what the key does when pressed or released
@ -39,17 +38,6 @@ pub struct KeyState {
}
impl KeyState {
#[must_use]
pub fn into_activated(self) -> KeyState {
match self.action {
Action::LockView { lock: _, unlock: _ } => KeyState {
locked: self.locked ^ true,
..self
},
_ => self,
}
}
#[must_use]
pub fn into_released(self) -> KeyState {
KeyState {
@ -233,7 +221,6 @@ mod tests {
keys: vec!(KeySym("a".into()), KeySym("c".into())),
},
keycodes: vec!(9, 10),
locked: false,
pressed: PressType::Released,
},
}).unwrap();