mod linux;
#[deprecated(since="0.2.3", note="This function was an anti-pattern. Use Bot::new() instead")]
pub fn new_bot() -> Bot {
Bot::new()
}
pub struct Bot {
display: linux::Display,
root_window: Option<linux::Window>,
}
impl Bot {
pub fn new() -> Bot {
Bot {
display: linux::open_display(None),
root_window: None,
}
}
#[cfg(target_os = "linux")]
pub fn push_key(&self, string: &str) {
linux::push_key(self.display, string);
}
#[cfg(target_os = "macos")]
pub fn push_key(&self, string: &str) {
unimplemented!();
}
#[cfg(target_os = "windows")]
pub fn push_key(&self, string: &str) {
unimplemented!();
}
#[cfg(target_os = "linux")]
pub fn type_keys(&self, string: &str) {
linux::type_keys(self.display, string);
}
#[cfg(target_os = "macos")]
pub fn type_keys(&self, string: &str) {
unimplemented!();
}
#[cfg(target_os = "windows")]
pub fn type_keys(&self, string: &str) {
unimplemented!();
}
#[cfg(target_os = "linux")]
pub fn set_mouse_pos(&mut self, x: i32, y: i32) {
if self.root_window.is_none() {
self.root_window = Some(linux::root_window(self.display, 0));
}
linux::set_mouse_pos(self.display, self.root_window.unwrap(), x, y);
}
#[cfg(target_os = "macos")]
pub fn set_mouse_pos(&mut self, x: i32, y: i32) {
unimplemented!();
}
#[cfg(target_os = "windows")]
pub fn set_mouse_pos(&mut self, x: i32, y: i32) {
unimplemented!();
}
#[cfg(target_os = "linux")]
pub fn move_mouse(&self, x: i32, y: i32) {
linux::move_mouse(self.display, x, y);
}
#[cfg(target_os = "macos")]
pub fn move_mouse(&self, x: i32, y: i32) {
unimplemented!();
}
#[cfg(target_os = "windows")]
pub fn move_mouse(&self, x: i32, y: i32) {
unimplemented!();
}
}