espanso/src/context/mod.rs

35 lines
766 B
Rust
Raw Normal View History

2019-09-12 20:14:41 +00:00
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "macos")]
2019-09-13 13:03:03 +00:00
pub(crate) mod macos;
2019-09-12 20:14:41 +00:00
use std::sync::mpsc::Sender;
use crate::event::Event;
pub trait Context {
fn eventloop(&self);
}
// MAC IMPLEMENTATION
#[cfg(target_os = "macos")]
2019-09-13 09:55:42 +00:00
pub fn new(send_channel: Sender<Event>) -> Box<dyn Context> {
macos::MacContext::new(send_channel)
2019-09-12 20:14:41 +00:00
}
// LINUX IMPLEMENTATION
#[cfg(target_os = "linux")]
pub fn new(send_channel: Sender<Event>) -> Box<dyn Context> { // TODO
let manager = linux::LinuxUIManager{};
manager.initialize();
manager
}
// WINDOWS IMPLEMENTATION
#[cfg(target_os = "windows")]
pub fn new(send_channel: Sender<Event>) -> Box<dyn Context> {
windows::WindowsContext::new(send_channel)
}