mirror of
https://github.com/wez/wezterm.git
synced 2024-12-19 19:31:49 +03:00
30 lines
631 B
Rust
30 lines
631 B
Rust
use failure::Error;
|
|
use glium::glutin::EventsLoopProxy;
|
|
use std::sync::mpsc::{channel, Receiver, Sender};
|
|
|
|
#[derive(Debug)]
|
|
pub enum WakeupMsg {
|
|
PtyReadable,
|
|
SigChld,
|
|
Paint,
|
|
Paste,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct Wakeup {
|
|
sender: Sender<WakeupMsg>,
|
|
proxy: EventsLoopProxy,
|
|
}
|
|
|
|
impl Wakeup {
|
|
pub fn new(proxy: EventsLoopProxy) -> (Receiver<WakeupMsg>, Self) {
|
|
let (sender, receiver) = channel();
|
|
(receiver, Self { sender, proxy })
|
|
}
|
|
pub fn send(&mut self, what: WakeupMsg) -> Result<(), Error> {
|
|
self.sender.send(what)?;
|
|
self.proxy.wakeup()?;
|
|
Ok(())
|
|
}
|
|
}
|