mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 02:16:00 +02:00
fix build example mouse.rs
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
626e630c9b
commit
75aeb616e4
1 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
use enigo::{Enigo, MouseButton, MouseControllable};
|
use enigo::{Enigo, MouseButton, MouseControllable};
|
||||||
|
#[cfg(windows)]
|
||||||
use winapi::um::winuser::WHEEL_DELTA;
|
use winapi::um::winuser::WHEEL_DELTA;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -26,16 +27,28 @@ fn main() {
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
{
|
{
|
||||||
|
#[cfg(windows)]
|
||||||
enigo.mouse_scroll_x(2 * WHEEL_DELTA as i32);
|
enigo.mouse_scroll_x(2 * WHEEL_DELTA as i32);
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
enigo.mouse_scroll_x(2);
|
||||||
thread::sleep(wait_time);
|
thread::sleep(wait_time);
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
enigo.mouse_scroll_x(-2 * WHEEL_DELTA as i32);
|
enigo.mouse_scroll_x(-2 * WHEEL_DELTA as i32);
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
enigo.mouse_scroll_x(-2);
|
||||||
thread::sleep(wait_time);
|
thread::sleep(wait_time);
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
enigo.mouse_scroll_y(2 * WHEEL_DELTA as i32);
|
enigo.mouse_scroll_y(2 * WHEEL_DELTA as i32);
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
enigo.mouse_scroll_y(2);
|
||||||
thread::sleep(wait_time);
|
thread::sleep(wait_time);
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
enigo.mouse_scroll_y(-2 * WHEEL_DELTA as i32);
|
enigo.mouse_scroll_y(-2 * WHEEL_DELTA as i32);
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
enigo.mouse_scroll_y(-2);
|
||||||
thread::sleep(wait_time);
|
thread::sleep(wait_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue