aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/event.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r--alacritty/src/event.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 25d52e56..2fb60b2a 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -10,6 +10,7 @@ use std::fmt::Debug;
use std::os::unix::io::RawFd;
use std::path::PathBuf;
use std::rc::Rc;
+use std::sync::atomic::Ordering;
use std::time::{Duration, Instant};
use std::{env, f32, mem};
@@ -101,6 +102,7 @@ pub enum EventType {
BlinkCursor,
BlinkCursorTimeout,
SearchNext,
+ Frame,
}
impl From<TerminalEvent> for EventType {
@@ -1096,6 +1098,9 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
self.ctx.window().scale_factor = scale_factor;
},
+ EventType::Frame => {
+ self.ctx.display.window.has_frame.store(true, Ordering::Relaxed);
+ },
EventType::SearchNext => self.ctx.goto_match(None),
EventType::Scroll(scroll) => self.ctx.scroll(scroll),
EventType::BlinkCursor => {
@@ -1450,11 +1455,6 @@ impl Processor {
},
// Process all pending events.
WinitEvent::RedrawEventsCleared => {
- *control_flow = match scheduler.update() {
- Some(instant) => ControlFlow::WaitUntil(instant),
- None => ControlFlow::Wait,
- };
-
// Check for pending frame callbacks on Wayland.
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
if let Some(wayland_event_queue) = self.wayland_event_queue.as_mut() {
@@ -1473,6 +1473,13 @@ impl Processor {
WinitEvent::RedrawEventsCleared,
);
}
+
+ // Update the scheduler after event processing to ensure
+ // the event loop deadline is as accurate as possible.
+ *control_flow = match scheduler.update() {
+ Some(instant) => ControlFlow::WaitUntil(instant),
+ None => ControlFlow::Wait,
+ };
},
// Process config update.
WinitEvent::UserEvent(Event { payload: EventType::ConfigReload(path), .. }) => {