Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix system repeat rate #62

Merged
merged 2 commits into from
Jan 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Keyboard: fix system repeat rate as repeats per second rather then millisecond delay between repeats
- Surface: fix panic in `compute_dpi_factor()` by only computing the dpi factor on surfaces known to the OutputMgr
- Window: `set_title()` now requires a manual `refresh()` for the change to take effect

Expand Down
6 changes: 4 additions & 2 deletions src/keyboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ impl Drop for KbState {
pub enum KeyRepeatKind {
/// keys will be repeated at a set rate and delay
Fixed {
/// rate (in milliseconds) at which the repetition should occur
/// the number of repetitions per second that should occur
rate: u64,
/// delay (in milliseconds) between a key press and the start of repetition
delay: u64,
Expand Down Expand Up @@ -729,7 +729,9 @@ where
proxy.clone(),
);
// Rate
thread::sleep(Duration::from_millis(repeat_timing.0));
thread::sleep(
Duration::from_secs(1) / repeat_timing.0 as u32,
);
match thread_kill_chan.lock().unwrap().1.try_recv() {
Ok(_) | Err(mpsc::TryRecvError::Disconnected) => {
break
Expand Down