From 5725f5812ca5e8d7d992da4ac66aa454a8a9a9ad Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Mon, 21 Dec 2020 06:40:22 +0000 Subject: Fix artifacts on macOS with transparent windows Due to the way macOS draws shadows for transparent windows, resizing them will lead to text artifacts remaining present after a window has been resized. The `invalidateShadow` call is used whenever the opacity isn't `1.0` to make sure these shadows are cleared before redrawing, so no artifacts remain when resizing transparent windows. Fixes #889. --- alacritty/src/display.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'alacritty/src/display.rs') diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs index 1fe1d2de..fb82b9f8 100644 --- a/alacritty/src/display.rs +++ b/alacritty/src/display.rs @@ -610,6 +610,12 @@ impl Display { #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] self.request_frame(&self.window); + // Clear window shadows to prevent shadow artifacts on macOS. + #[cfg(target_os = "macos")] + if config.ui_config.background_opacity() < 1.0 { + self.window.invalidate_shadow(); + } + self.window.swap_buffers(); #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] -- cgit