From f2b504ee1f9a607fe8965e96b659bca282147672 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 28 Oct 2020 16:08:33 -0700 Subject: [PATCH] window: alternative shadow/ghost/macos fix This one invalidates the shadow when we invalidate the window, so we should get to keep the shadow and lose the ghosts. refs: #310 --- window/src/os/macos/window.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index cfbc19d64..89f0ce5fc 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -405,10 +405,6 @@ impl Window { window.setReleasedWhenClosed_(NO); 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 - window.setHasShadow_(NO); let ns_color: id = msg_send![Class::get("NSColor").unwrap(), alloc]; window.setBackgroundColor_(cocoa::appkit::NSColor::clearColor(ns_color)); @@ -667,6 +663,10 @@ impl WindowOpsMut for WindowInner { fn invalidate(&mut self) { unsafe { let () = msg_send![*self.view, setNeedsDisplay: YES]; + // Explicitly invalidate the window shadow to avoid + // leaving behind ghost remnants! + // see: https://github.com/wez/wezterm/issues/310 + NSWindow::invalidateShadow(*self.window); } } fn set_title(&mut self, title: &str) {