Skip to content

Commit

Permalink
Merge pull request #474 from CryZe/linux-hotkeys-evdev
Browse files Browse the repository at this point in the history
Switch to evdev for Linux hotkeys
  • Loading branch information
CryZe authored Nov 9, 2021
2 parents 0b83efd + 879a9e3 commit 0acdf90
Show file tree
Hide file tree
Showing 3 changed files with 290 additions and 331 deletions.
4 changes: 2 additions & 2 deletions crates/livesplit-hotkey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ winapi = { version = "0.3.2", features = [
parking_lot = { version = "0.11.0", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
x11-dl = { version = "2.18.5", optional = true }
evdev = { version = "0.11.1", optional = true }
mio = { version = "0.7.7", default-features = false, features = ["os-ext", "os-poll"], optional = true }
promising-future = { version = "0.2.4", optional = true }

Expand All @@ -37,5 +37,5 @@ snafu = { version = "0.6.0", default-features = false }

[features]
default = ["std"]
std = ["snafu/std", "serde/std", "parking_lot", "x11-dl", "mio", "promising-future", "winapi", "bitflags"]
std = ["snafu/std", "serde/std", "parking_lot", "evdev", "mio", "promising-future", "winapi", "bitflags"]
wasm-web = ["wasm-bindgen", "web-sys", "parking_lot/wasm-bindgen"]
6 changes: 3 additions & 3 deletions crates/livesplit-hotkey/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ mod tests {
println!("Press Numpad1");
thread::sleep(Duration::from_secs(5));
hook.unregister(KeyCode::Numpad1).unwrap();
hook.register(KeyCode::Numpad4, || println!("B")).unwrap();
println!("Press Numpad4");
hook.register(KeyCode::KeyN, || println!("B")).unwrap();
println!("Press KeyN");
thread::sleep(Duration::from_secs(5));
hook.unregister(KeyCode::Numpad4).unwrap();
hook.unregister(KeyCode::KeyN).unwrap();
hook.register(KeyCode::Numpad1, || println!("C")).unwrap();
println!("Press Numpad1");
thread::sleep(Duration::from_secs(5));
Expand Down
Loading

0 comments on commit 0acdf90

Please sign in to comment.