2019-08-30 17:45:27 +00:00
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
mod windows;
|
|
|
|
|
|
|
|
use std::sync::mpsc;
|
|
|
|
|
2019-08-30 19:24:03 +00:00
|
|
|
pub trait KeyboardInterceptor {
|
2019-08-30 17:45:27 +00:00
|
|
|
fn initialize(&self);
|
|
|
|
fn start(&self);
|
|
|
|
}
|
|
|
|
|
2019-08-30 19:24:03 +00:00
|
|
|
pub trait KeyboardSender {
|
|
|
|
fn send_string(&self, s: &str);
|
2019-08-31 14:07:45 +00:00
|
|
|
fn delete_string(&self, count: i32);
|
2019-08-30 19:24:03 +00:00
|
|
|
}
|
|
|
|
|
2019-08-30 17:45:27 +00:00
|
|
|
#[cfg(target_os = "windows")]
|
2019-08-31 14:07:45 +00:00
|
|
|
pub fn get_interceptor(sender: mpsc::Sender<char>) -> impl KeyboardInterceptor {
|
|
|
|
windows::WindowsKeyboardInterceptor {sender}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
pub fn get_sender() -> impl KeyboardSender {
|
|
|
|
windows::WindowsKeyboardSender{}
|
2019-08-30 17:45:27 +00:00
|
|
|
}
|