Skip to content

Commit

Permalink
wayland: Don't forget RepeatInfo on deactivate
Browse files Browse the repository at this point in the history
  • Loading branch information
simnalamburt committed Feb 6, 2021
1 parent e4e3e89 commit 59e085c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/frontends/wayland/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ struct KimeContext {

// Key repeat contexts
timer: TimerFd,
/// `None` if `KimeContext` have never received a `RepeatInfo`. `Some(..)` if `RepeatInfo` is
/// known and kime-wayland started tracking the press state of keys.
/// `None` if `KimeContext` have never received a `RepeatInfo` or repeat is disabled (i.e. rate
/// is zero). `Some(..)` if `RepeatInfo` is known and kime-wayland started tracking the press
/// state of keys.
repeat_state: Option<(RepeatInfo, PressState)>,
}

Expand Down Expand Up @@ -191,8 +192,12 @@ impl KimeContext {
// Focus lost, reset states
self.engine.reset();
self.grab_activate = false;

// Input deactivated, stop repeating
self.timer.disarm().unwrap();
self.repeat_state = None
if let Some((_, ref mut press_state)) = self.repeat_state {
*press_state = PressState::NotPressing
}
}
self.current_state = std::mem::take(&mut self.pending_state);
}
Expand Down

0 comments on commit 59e085c

Please sign in to comment.