aboutsummaryrefslogtreecommitdiff
path: root/src/event_loop.rs
diff options
context:
space:
mode:
authorJonathan Schleußer <paradoxspiral@riseup.net>2017-08-30 20:43:37 +0200
committerJoe Wilm <jwilm@users.noreply.github.com>2017-09-05 09:07:00 -0700
commita3d35ec1859802a2440d29ac24d87bf347a6144e (patch)
tree909c86e052cf52fcac86b241739508965e2dcf02 /src/event_loop.rs
parent967393a31c4b722266e9bc4e74b89d0a23a82dbb (diff)
downloadalacritty-a3d35ec1859802a2440d29ac24d87bf347a6144e.tar.gz
alacritty-a3d35ec1859802a2440d29ac24d87bf347a6144e.zip
Update most remaining deps
Diffstat (limited to 'src/event_loop.rs')
-rw-r--r--src/event_loop.rs25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/event_loop.rs b/src/event_loop.rs
index 56d8b992..5095f359 100644
--- a/src/event_loop.rs
+++ b/src/event_loop.rs
@@ -7,7 +7,10 @@ use std::os::unix::io::AsRawFd;
use std::sync::Arc;
use mio::{self, Events, PollOpt, Ready};
+#[cfg(unix)]
+use mio::unix::UnixReady;
use mio::unix::EventedFd;
+use mio_more::channel::{self, Sender, Receiver};
use ansi;
use display;
@@ -33,8 +36,8 @@ pub enum Msg {
pub struct EventLoop<Io> {
poll: mio::Poll,
pty: Io,
- rx: mio::channel::Receiver<Msg>,
- tx: mio::channel::Sender<Msg>,
+ rx: Receiver<Msg>,
+ tx: Sender<Msg>,
terminal: Arc<FairMutex<Term>>,
display: display::Notifier,
ref_test: bool,
@@ -76,7 +79,7 @@ pub struct State {
parser: ansi::Processor,
}
-pub struct Notifier(pub ::mio::channel::Sender<Msg>);
+pub struct Notifier(pub Sender<Msg>);
impl event::Notify for Notifier {
fn notify<B>(&mut self, bytes: B)
@@ -174,7 +177,7 @@ impl<Io> EventLoop<Io>
pty: Io,
ref_test: bool,
) -> EventLoop<Io> {
- let (tx, rx) = ::mio::channel::channel();
+ let (tx, rx) = channel::channel();
EventLoop {
poll: mio::Poll::new().expect("create mio Poll"),
pty: pty,
@@ -186,7 +189,7 @@ impl<Io> EventLoop<Io>
}
}
- pub fn channel(&self) -> mio::channel::Sender<Msg> {
+ pub fn channel(&self) -> Sender<Msg> {
self.tx.clone()
}
@@ -384,13 +387,15 @@ impl<Io> EventLoop<Io>
}
},
PTY => {
- let kind = event.kind();
+ let ready = event.readiness();
- if kind.is_hup() {
- break 'event_loop;
+ #[cfg(unix)] {
+ if UnixReady::from(ready).is_hup() {
+ break 'event_loop;
+ }
}
- if kind.is_readable() {
+ if ready.is_readable() {
if let Err(err) = self.pty_read(&mut state, &mut buf, pipe.as_mut()) {
error!("Event loop exitting due to error: {} [{}:{}]",
err, file!(), line!());
@@ -402,7 +407,7 @@ impl<Io> EventLoop<Io>
}
}
- if kind.is_writable() {
+ if ready.is_writable() {
if let Err(err) = self.pty_write(&mut state) {
error!("Event loop exitting due to error: {} [{}:{}]",
err, file!(), line!());