openloaf-rdev 0.5.1

OpenLoaf fork of rdev — listen and send keyboard / mouse events on Windows, Linux and MacOS. Adds macOS event tap auto re-enable on kCGEventTapDisabledByTimeout / ByUserInput so a temporarily disabled tap doesn't silently drop the next batch of key events.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use rdev::Key as RdevKey;

#[test]
fn test_convet_keycode() {
    let key = RdevKey::KeyQ;
    let (keycode, scancode) = (81, 16);

    assert_eq!(key, rdev::get_win_key(keycode, scancode));
    assert_eq!((81, 16), rdev::get_win_codes(key).unwrap());

    assert_eq!(16, rdev::win_scancode_from_key(key).unwrap()); // Windows
    assert_eq!(24, rdev::linux_keycode_from_key(key).unwrap()); // Linux
    assert_eq!(12, rdev::macos_keycode_from_key(key).unwrap()); // Mac OS
}