Skip to content

Commit 75aeb61

Browse files
committed
fix build example mouse.rs
Signed-off-by: fufesou <[email protected]>
1 parent 626e630 commit 75aeb61

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

libs/enigo/examples/mouse.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use enigo::{Enigo, MouseButton, MouseControllable};
2+
#[cfg(windows)]
23
use winapi::um::winuser::WHEEL_DELTA;
34
use std::thread;
45
use std::time::Duration;
@@ -26,16 +27,28 @@ fn main() {
2627

2728
#[cfg(not(target_os = "macos"))]
2829
{
30+
#[cfg(windows)]
2931
enigo.mouse_scroll_x(2 * WHEEL_DELTA as i32);
32+
#[cfg(not(windows))]
33+
enigo.mouse_scroll_x(2);
3034
thread::sleep(wait_time);
3135

36+
#[cfg(windows)]
3237
enigo.mouse_scroll_x(-2 * WHEEL_DELTA as i32);
38+
#[cfg(not(windows))]
39+
enigo.mouse_scroll_x(-2);
3340
thread::sleep(wait_time);
3441

42+
#[cfg(windows)]
3543
enigo.mouse_scroll_y(2 * WHEEL_DELTA as i32);
44+
#[cfg(not(windows))]
45+
enigo.mouse_scroll_y(2);
3646
thread::sleep(wait_time);
3747

48+
#[cfg(windows)]
3849
enigo.mouse_scroll_y(-2 * WHEEL_DELTA as i32);
50+
#[cfg(not(windows))]
51+
enigo.mouse_scroll_y(-2);
3952
thread::sleep(wait_time);
4053
}
4154
}

0 commit comments

Comments
 (0)