From baf168e458d7618be10366a3a19121e0a6efb492 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 30 Jan 2021 08:02:48 -0800 Subject: [PATCH] window: slightly condense opaque/shadow setting logic refs: #445 --- window/src/os/macos/window.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 3a8edf711..4438ac011 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -702,19 +702,18 @@ impl WindowInner { } fn update_window_shadow(&mut self) { - if config().window_background_opacity() < 1.0 { - unsafe { - self.window.setOpaque_(NO); - // Turn off the window shadow, because when the background is transparent - // having the shadow enabled seems to correlate with ghostly remnants - // see: https://github.com/wez/wezterm/issues/310 - self.window.setHasShadow_(NO); - } + let is_opaque = if config().window_background_opacity() >= 1.0 { + YES } else { - unsafe { - self.window.setOpaque_(YES); - self.window.setHasShadow_(YES); - } + NO + }; + unsafe { + self.window.setOpaque_(is_opaque); + // when transparent, also turn off the window shadow, + // because having the shadow enabled seems to correlate + // with ghostly remnants see: + // https://github.com/wez/wezterm/issues/310 + self.window.setHasShadow_(is_opaque); } } }