support linux mouse back/forward

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-01-05 17:45:07 +08:00
parent 97cf85d1b7
commit b4feae33bb
2 changed files with 10 additions and 2 deletions

View File

@ -57,6 +57,8 @@ fn mousebutton(button: MouseButton) -> c_int {
MouseButton::ScrollDown => 5,
MouseButton::ScrollLeft => 6,
MouseButton::ScrollRight => 7,
MouseButton::Back => 8,
MouseButton::Forward => 9,
}
}

View File

@ -226,7 +226,10 @@ impl MouseControllable for Enigo {
MouseButton::Left => (CGMouseButton::Left, CGEventType::LeftMouseDown),
MouseButton::Middle => (CGMouseButton::Center, CGEventType::OtherMouseDown),
MouseButton::Right => (CGMouseButton::Right, CGEventType::RightMouseDown),
_ => unimplemented!(),
_ => {
log::info!("Unsupported button {:?}", button);
return Ok(());
},
};
let dest = CGPoint::new(current_x as f64, current_y as f64);
if let Some(src) = self.event_source.as_ref() {
@ -249,7 +252,10 @@ impl MouseControllable for Enigo {
MouseButton::Left => (CGMouseButton::Left, CGEventType::LeftMouseUp),
MouseButton::Middle => (CGMouseButton::Center, CGEventType::OtherMouseUp),
MouseButton::Right => (CGMouseButton::Right, CGEventType::RightMouseUp),
_ => unimplemented!(),
_ => {
log::info!("Unsupported button {:?}", button);
return;
},
};
let dest = CGPoint::new(current_x as f64, current_y as f64);
if let Some(src) = self.event_source.as_ref() {