aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--alacritty/src/display.rs26
-rw-r--r--alacritty/src/renderer/mod.rs6
3 files changed, 32 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbe1ab17..4534989b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Tabstops not being reset with `reset`
- Selection not cleared when switching between main and alt grid
- Fallback to `LC_CTYPE=UTF-8` on macOS without valid system locale
+- Resize lag on launch under some X11 wms
+- Increased input latency due to vsync behavior on X11
## 0.4.2
diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs
index eafab8c2..980b0ea0 100644
--- a/alacritty/src/display.rs
+++ b/alacritty/src/display.rs
@@ -118,6 +118,8 @@ pub struct Display {
renderer: QuadRenderer,
glyph_cache: GlyphCache,
meter: Meter,
+ #[cfg(not(any(target_os = "macos", windows)))]
+ is_x11: bool,
}
impl Display {
@@ -198,14 +200,20 @@ impl Display {
api.clear(background_color);
});
+ #[cfg(not(any(target_os = "macos", windows)))]
+ let is_x11 = event_loop.is_x11();
+
// We should call `clear` when window is offscreen, so when `window.show()` happens it
// would be with background color instead of uninitialized surface.
#[cfg(not(any(target_os = "macos", windows)))]
{
// On Wayland we can safely ignore this call, since the window isn't visible until you
// actually draw something into it.
- if event_loop.is_x11() {
- window.swap_buffers()
+ if is_x11 {
+ window.swap_buffers();
+ renderer.with_api(&config, &size_info, |api| {
+ api.finish();
+ });
}
}
@@ -237,6 +245,8 @@ impl Display {
size_info,
urls: Urls::new(),
highlighted_url: None,
+ #[cfg(not(any(target_os = "macos", windows)))]
+ is_x11,
})
}
@@ -499,6 +509,18 @@ impl Display {
}
self.window.swap_buffers();
+
+ #[cfg(not(any(target_os = "macos", windows)))]
+ {
+ if self.is_x11 {
+ // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
+ // will block to synchronize (this is `glClear` in Alacritty), which causes a
+ // permanent one frame delay.
+ self.renderer.with_api(&config, &size_info, |api| {
+ api.finish();
+ });
+ }
+ }
}
}
diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs
index 764b5ec5..f62e6f8d 100644
--- a/alacritty/src/renderer/mod.rs
+++ b/alacritty/src/renderer/mod.rs
@@ -923,6 +923,12 @@ impl<'a, C> RenderApi<'a, C> {
}
}
+ pub fn finish(&self) {
+ unsafe {
+ gl::Finish();
+ }
+ }
+
fn render_batch(&mut self) {
unsafe {
gl::BufferSubData(