diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-10 23:32:12 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-11 20:23:41 -0800 |
commit | 4df29bb37700ee9f2b8e09374c6db513daae89b3 (patch) | |
tree | 94189e2ea834578ed7130699c6d11e770086200f /src/event.rs | |
parent | ed0b1cfff04903fe26f586340e036c38bbf30b33 (diff) | |
download | alacritty-4df29bb37700ee9f2b8e09374c6db513daae89b3.tar.gz alacritty-4df29bb37700ee9f2b8e09374c6db513daae89b3.zip |
Finish main.rs cleanup
* config::Monitor is more ergonomic and self-contained
* Fixed an issue with macOS resize. Previously, the terminal was marked
as dirty in the window resize handler, but the display can't do that.
Instead, the event processor returns a flag whether it was requested
to wakeup.
Diffstat (limited to 'src/event.rs')
-rw-r--r-- | src/event.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/event.rs b/src/event.rs index 2a27dd61..d8fec37e 100644 --- a/src/event.rs +++ b/src/event.rs @@ -43,7 +43,7 @@ impl<N: input::Notify> Processor<N> { } } - fn handle_event(&mut self, event: glutin::Event) { + fn handle_event(&mut self, event: glutin::Event, wakeup_request: &mut bool) { match event { glutin::Event::Closed => { if self.ref_test { @@ -111,20 +111,26 @@ impl<N: input::Notify> Processor<N> { &terminal ); }, + glutin::Event::Awakened => { + *wakeup_request = true; + }, _ => (), } } /// Process at least one event and handle any additional queued events. - pub fn process_events(&mut self, window: &Window) { + pub fn process_events(&mut self, window: &Window) -> bool { + let mut wakeup_request = false; for event in window.wait_events() { - self.handle_event(event); + self.handle_event(event, &mut wakeup_request); break; } for event in window.poll_events() { - self.handle_event(event); + self.handle_event(event, &mut wakeup_request); } + + wakeup_request } pub fn update_config(&mut self, config: &Config) { |