obv-mikhail / InputBot

Rust library for creating global hotkeys, and simulating inputs
MIT License
414 stars 74 forks source link

InputBox crashes #59

Open Neutron3529 opened 2 years ago

Neutron3529 commented 2 years ago
RUST_BACKTRACE=full sudo --preserve-env=RUST_BACKTRACE target/debug/Clicker
thread 'main' panicked at 'libinput returned invalid 'libinput_event_type'', /home/.../input-0.6.0/src/event.rs:108:18

This error is generated when I scroll my mouse, it seems that there is a bug in input-0.6.0, I update input to 0.7.1 and the bug solved.

(I also edited line 201 of mod.rs to make rustc happy.)

let keyboard_key_event = if let KeyboardEvent::Key(keyboard_key_event) = keyboard_event { keyboard_key_event } else { todo!() };

besides, there are 6 warnings after update:

warning: unreachable pattern
   --> inputbot-0.5.1/src/linux/inputs.rs:180:9
    |
180 |         0x52 => Some(Numpad0Key),
    |         ^^^^
    |
    = note: `#[warn(unreachable_patterns)]` on by default

warning: unreachable pattern
   --> inputbot-0.5.1/src/linux/inputs.rs:182:9
    |
182 |         0x50 => Some(Numpad2Key),
    |         ^^^^

warning: unreachable pattern
   --> inputbot-0.5.1/src/linux/inputs.rs:184:9
    |
184 |         0x4b => Some(Numpad4Key),
    |         ^^^^

warning: unreachable pattern
   --> inputbot-0.5.1/src/linux/inputs.rs:186:9
    |
186 |         0x4d => Some(Numpad6Key),
    |         ^^^^

warning: unreachable pattern
   --> inputbot-0.5.1/src/linux/inputs.rs:187:9
    |
187 |         0x47 => Some(Numpad7Key),
    |         ^^^^

warning: unreachable pattern
   --> inputbot-0.5.1/src/linux/inputs.rs:188:9
    |
188 |         0x48 => Some(Numpad8Key),
    |         ^^^^

warning: `inputbot` (lib) generated 6 warnings

I have no idea of those code, since they do not bother my program.