aboutsummaryrefslogtreecommitdiff
path: root/src/event_loop.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-10 22:44:13 -0800
committerJoe Wilm <joe@jwilm.com>2016-12-11 20:23:41 -0800
commited0b1cfff04903fe26f586340e036c38bbf30b33 (patch)
treeeb4eb3545bee57ed401cb7727c9dc3f106fabe3b /src/event_loop.rs
parentbbd8ddbfc055e85f8810285e71fd227cdd418221 (diff)
downloadalacritty-ed0b1cfff04903fe26f586340e036c38bbf30b33.tar.gz
alacritty-ed0b1cfff04903fe26f586340e036c38bbf30b33.zip
Display manages window, renderer, rasterizer
This is part of an ongoing decoupling effort across the codebase and tidying effort in main.rs. Everything to do with showing the window with a grid of characters is now managed by the `Display` type. It owns the window, the font rasterizer, and the renderer. The only info needed from it are dimensions of characters and the window itself for sizing the terminal properly. Additionally, the I/O loop has access to wake it up when new data arrives.
Diffstat (limited to 'src/event_loop.rs')
-rw-r--r--src/event_loop.rs23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/event_loop.rs b/src/event_loop.rs
index c2c5ce69..70aa4acb 100644
--- a/src/event_loop.rs
+++ b/src/event_loop.rs
@@ -10,14 +10,11 @@ use mio::{self, Events, PollOpt, Ready};
use mio::unix::EventedFd;
use ansi;
+use display;
use term::Term;
use util::thread;
use sync::FairMutex;
-use window;
-
-use super::Flag;
-
/// Messages that may be sent to the `EventLoop`
#[derive(Debug)]
pub enum Msg {
@@ -35,8 +32,7 @@ pub struct EventLoop<Io> {
rx: mio::channel::Receiver<Msg>,
tx: mio::channel::Sender<Msg>,
terminal: Arc<FairMutex<Term>>,
- proxy: window::Proxy,
- signal_flag: Flag,
+ display: display::Notifier,
ref_test: bool,
}
@@ -131,8 +127,7 @@ impl<Io> EventLoop<Io>
/// Create a new event loop
pub fn new(
terminal: Arc<FairMutex<Term>>,
- proxy: window::Proxy,
- signal_flag: Flag,
+ display: display::Notifier,
pty: Io,
ref_test: bool,
) -> EventLoop<Io> {
@@ -143,8 +138,7 @@ impl<Io> EventLoop<Io>
tx: tx,
rx: rx,
terminal: terminal,
- proxy: proxy,
- signal_flag: signal_flag,
+ display: display,
ref_test: ref_test,
}
}
@@ -196,14 +190,7 @@ impl<Io> EventLoop<Io>
terminal.dirty = true;
- // Only wake up the event loop if it hasn't already been
- // signaled. This is a really important optimization because
- // waking up the event loop redundantly burns *a lot* of
- // cycles.
- if !self.signal_flag.get() {
- self.proxy.wakeup_event_loop();
- self.signal_flag.set(true);
- }
+ self.display.notify();
},
Err(err) => {
match err.kind() {