diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-11 22:02:03 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-11 22:02:03 -0800 |
commit | 4b63bddd55853e878ec0f85b4613dd02749a3811 (patch) | |
tree | 02faaf58b29e3e8c5767bca1c2254376d2f47fb6 /src/event.rs | |
parent | 79e02b0b2f2feb127ff1c7dc998d4696e005003a (diff) | |
download | alacritty-4b63bddd55853e878ec0f85b4613dd02749a3811.tar.gz alacritty-4b63bddd55853e878ec0f85b4613dd02749a3811.zip |
Track terminal cells on mouse movement
The cell under the cursor is now tracked in the input processor at
`self.mouse.line` and `self.mouse.column`. This could probably be
optimized to only compute the cell when in certain states, but the
calculation is cheap.
Diffstat (limited to 'src/event.rs')
-rw-r--r-- | src/event.rs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/event.rs b/src/event.rs index d8fec37e..4f28649e 100644 --- a/src/event.rs +++ b/src/event.rs @@ -10,7 +10,7 @@ use window::Window; use input; use sync::FairMutex; -use term::Term; +use term::{self, Term}; use config::Config; /// The event processor @@ -34,15 +34,27 @@ impl<N: input::Notify> Processor<N> { config: &Config, ref_test: bool, ) -> Processor<N> { + let input_processor = { + let terminal = terminal.lock(); + input::Processor::new(config, terminal.size_info()) + }; + Processor { notifier: notifier, terminal: terminal, - input_processor: input::Processor::new(config), + input_processor: input_processor, resize_tx: resize_tx, ref_test: ref_test, } } + /// Notify that the terminal was resized + /// + /// Currently this just forwards the notice to the input processor. + pub fn resize(&mut self, size_info: &term::SizeInfo) { + self.input_processor.resize(size_info); + } + fn handle_event(&mut self, event: glutin::Event, wakeup_request: &mut bool) { match event { glutin::Event::Closed => { @@ -71,9 +83,11 @@ impl<N: input::Notify> Processor<N> { }, glutin::Event::Resized(w, h) => { self.resize_tx.send((w, h)).expect("send new size"); - // Acquire term lock - let mut terminal = self.terminal.lock(); - terminal.dirty = true; + + // Previously, this marked the terminal state as "dirty", but + // now the wakeup_request controls whether a display update is + // triggered. + *wakeup_request = true; }, glutin::Event::KeyboardInput(state, _code, key, mods, string) => { // Acquire term lock |