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-30 17:45:27 +00:00
|
|
|
#[cfg(target_os = "windows")]
|
2019-08-30 19:24:03 +00:00
|
|
|
pub fn get_backend(sender: mpsc::Sender<char>) -> (impl KeyboardInterceptor, impl KeyboardSender) {
|
|
|
|
(windows::WindowsKeyboardInterceptor {sender}, windows::WindowsKeyboardSender{})
|
2019-08-30 17:45:27 +00:00
|
|
|
}
|