diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-12-22 04:25:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 04:25:43 +0000 |
commit | f19cbca9b4c98a33b786bd971e3abae66bd16e26 (patch) | |
tree | 7fe9ebce9cc2354029eb5458fe4517a194fd94da /alacritty/src/display.rs | |
parent | 8982000f01d5f476a995385253139b3555e2a5d0 (diff) | |
download | r-alacritty-f19cbca9b4c98a33b786bd971e3abae66bd16e26.tar.gz r-alacritty-f19cbca9b4c98a33b786bd971e3abae66bd16e26.tar.bz2 r-alacritty-f19cbca9b4c98a33b786bd971e3abae66bd16e26.zip |
Disable shadows for transparent windows on macOS
Commit 5725f58 introduced a performance regression on macOS due to
excessive calls to the `invalidateShadow` function, however calling this
function only on redraw after a resize was performed does not fix the
underlying problem.
As a solution, window shadows are now disabled completely for all
transparent windows. This makes sure there is no performance impact,
while still solving the problem with text artifacts on resize.
Fixes #4604.
Diffstat (limited to 'alacritty/src/display.rs')
-rw-r--r-- | alacritty/src/display.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs index fb82b9f8..7fbf0d54 100644 --- a/alacritty/src/display.rs +++ b/alacritty/src/display.rs @@ -254,6 +254,10 @@ impl Display { #[cfg(target_os = "macos")] crossfont::set_font_smoothing(config.ui_config.font.use_thin_strokes); + // Disable shadows for transparent windows on macOS. + #[cfg(target_os = "macos")] + window.set_has_shadow(config.ui_config.background_opacity() >= 1.0); + #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] let is_x11 = event_loop.is_x11(); #[cfg(not(any(feature = "x11", target_os = "macos", windows)))] @@ -610,12 +614,6 @@ 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))))] |