debugging

This commit is contained in:
crusader 2020-12-23 14:39:03 +09:00
parent 993a5ac756
commit 12ccc1061b

View File

@ -50,25 +50,25 @@ impl Robot {
} }
pub fn mouse_move_to(dx: i32, dy: i32) { pub fn mouse_move_to(dx: i32, dy: i32) {
let width = unsafe { GetSystemMetrics(SM_CXVIRTUALSCREEN) }; // let width = unsafe { GetSystemMetrics(SM_CXVIRTUALSCREEN) };
let height = unsafe { GetSystemMetrics(SM_CYVIRTUALSCREEN) }; // let height = unsafe { GetSystemMetrics(SM_CYVIRTUALSCREEN) };
if width == 0 || height == 0 { // if width == 0 || height == 0 {
return; // return;
} // }
let pressed_left = Self::mouse_pressed(Button::Left); // let pressed_left = Self::mouse_pressed(Button::Left);
let pressed_right = Self::mouse_pressed(Button::Right); // let pressed_right = Self::mouse_pressed(Button::Right);
let pressed_middle = Self::mouse_pressed(Button::Middle); // let pressed_middle = Self::mouse_pressed(Button::Middle);
let mut dw_flags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK; let dw_flags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
if pressed_left { // if pressed_left {
dw_flags = dw_flags | MOUSEEVENTF_LEFTDOWN; // dw_flags = dw_flags | MOUSEEVENTF_LEFTDOWN;
} // }
if pressed_right { // if pressed_right {
dw_flags = dw_flags | MOUSEEVENTF_RIGHTDOWN; // dw_flags = dw_flags | MOUSEEVENTF_RIGHTDOWN;
} // }
if pressed_middle { // if pressed_middle {
dw_flags = dw_flags | MOUSEEVENTF_MIDDLEDOWN; // dw_flags = dw_flags | MOUSEEVENTF_MIDDLEDOWN;
} // }
Self::mouse_event( Self::mouse_event(
(dx - unsafe { GetSystemMetrics(SM_XVIRTUALSCREEN) }) * 65535 (dx - unsafe { GetSystemMetrics(SM_XVIRTUALSCREEN) }) * 65535