diff options
-rw-r--r-- | src/event.rs | 2 | ||||
-rw-r--r-- | src/input.rs | 13 | ||||
-rw-r--r-- | src/main.rs | 5 | ||||
-rw-r--r-- | src/tty.rs | 9 |
4 files changed, 2 insertions, 27 deletions
diff --git a/src/event.rs b/src/event.rs index f44fd86c..1b30ed64 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,7 +1,5 @@ //! Process window events -use std::io; use std::sync::{Arc, mpsc}; -use std; use glutin; diff --git a/src/input.rs b/src/input.rs index 829312e7..b2263d6e 100644 --- a/src/input.rs +++ b/src/input.rs @@ -24,7 +24,6 @@ //! //! TODO handling xmodmap would be good use std::borrow::Cow; -use std::io::Write; use glutin::{ElementState, VirtualKeyCode}; use glutin::{Mods, mods}; @@ -48,18 +47,6 @@ pub trait Notify { fn notify<B: Into<Cow<'static, [u8]>>>(&mut self, B); } -/// A notifier type that simply writes bytes to the provided `Write` type -pub struct WriteNotifier<'a, W: Write + 'a>(pub &'a mut W); - -impl<'a, W: Write> Notify for WriteNotifier<'a, W> { - fn notify<B>(&mut self, bytes: B) - where B: Into<Cow<'static, [u8]>> - { - let message = bytes.into(); - self.0.write_all(&message[..]).unwrap(); - } -} - pub struct LoopNotifier(pub ::mio::channel::Sender<::EventLoopMessage>); impl Notify for LoopNotifier { diff --git a/src/main.rs b/src/main.rs index c6694ce9..4c740ad2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -276,7 +276,7 @@ impl EventLoop { self.tx.clone() } - pub fn spawn(mut self) -> std::thread::JoinHandle<()> { + pub fn spawn(self) -> std::thread::JoinHandle<()> { use mio::{Events, PollOpt, Ready}; use mio::unix::EventedFd; use std::borrow::Cow; @@ -312,7 +312,7 @@ impl EventLoop { thread::spawn_named("pty reader", move || { - let EventLoop { mut poll, mut pty, rx, terminal, proxy, signal_flag, .. } = self; + let EventLoop { poll, mut pty, rx, terminal, proxy, signal_flag, .. } = self; let mut buf = [0u8; 4096]; @@ -401,7 +401,6 @@ impl EventLoop { 'write_list_loop: while let Some(mut write_now) = writing.take() { loop { - let start = write_now.written; match pty.write(write_now.remaining_bytes()) { Ok(0) => { writing = Some(write_now); @@ -299,15 +299,6 @@ impl Tty { } } - /// Get writer for the TTY - /// - /// XXX File is a bad abstraction here; it closes the fd on drop - pub fn writer(&self) -> File { - unsafe { - File::from_raw_fd(self.fd) - } - } - pub fn resize(&self, rows: usize, cols: usize, px_x: usize, px_y: usize) { let win = winsize { ws_row: rows as libc::c_ushort, |