Fix high startup time on wlroots compositors
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c3c411..2c6a1e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@
- Deadlock on Windows when closing Alacritty using the title bar "X" button (ConPTY backend)
- Crash on `clear` when scrolled up in history
- Entire screen getting underlined/stroke out when running `clear`
+- Slow startup on some Wayland compositors
## 0.4.0
diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs
index f64deae..5e800ed 100644
--- a/alacritty/src/display.rs
+++ b/alacritty/src/display.rs
@@ -21,6 +21,8 @@
use glutin::dpi::{PhysicalPosition, PhysicalSize};
use glutin::event::ModifiersState;
use glutin::event_loop::EventLoop;
+#[cfg(not(any(target_os = "macos", windows)))]
+use glutin::platform::unix::EventLoopWindowTargetExtUnix;
use glutin::window::CursorIcon;
use log::{debug, info};
use parking_lot::MutexGuard;
@@ -208,7 +210,14 @@
// We should call `clear` when window is offscreen, so when `window.show()` happens it
// would be with background color instead of uninitialized surface.
- window.swap_buffers();
+ #[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()
+ }
+ }
window.set_visible(true);