diff --git a/src/windows/mouse.rs b/src/windows/mouse.rs index ff17503..512c2cf 100644 --- a/src/windows/mouse.rs +++ b/src/windows/mouse.rs @@ -50,25 +50,25 @@ impl Robot { } pub fn mouse_move_to(dx: i32, dy: i32) { - let width = unsafe { GetSystemMetrics(SM_CXVIRTUALSCREEN) }; - let height = unsafe { GetSystemMetrics(SM_CYVIRTUALSCREEN) }; - if width == 0 || height == 0 { - return; - } - let pressed_left = Self::mouse_pressed(Button::Left); - let pressed_right = Self::mouse_pressed(Button::Right); - let pressed_middle = Self::mouse_pressed(Button::Middle); - let mut dw_flags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK; + // let width = unsafe { GetSystemMetrics(SM_CXVIRTUALSCREEN) }; + // let height = unsafe { GetSystemMetrics(SM_CYVIRTUALSCREEN) }; + // if width == 0 || height == 0 { + // return; + // } + // let pressed_left = Self::mouse_pressed(Button::Left); + // let pressed_right = Self::mouse_pressed(Button::Right); + // let pressed_middle = Self::mouse_pressed(Button::Middle); + let dw_flags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK; - if pressed_left { - dw_flags = dw_flags | MOUSEEVENTF_LEFTDOWN; - } - if pressed_right { - dw_flags = dw_flags | MOUSEEVENTF_RIGHTDOWN; - } - if pressed_middle { - dw_flags = dw_flags | MOUSEEVENTF_MIDDLEDOWN; - } + // if pressed_left { + // dw_flags = dw_flags | MOUSEEVENTF_LEFTDOWN; + // } + // if pressed_right { + // dw_flags = dw_flags | MOUSEEVENTF_RIGHTDOWN; + // } + // if pressed_middle { + // dw_flags = dw_flags | MOUSEEVENTF_MIDDLEDOWN; + // } Self::mouse_event( (dx - unsafe { GetSystemMetrics(SM_XVIRTUALSCREEN) }) * 65535