From e3100c937fed55f326ee1eea6ff3eea3f22cd09f Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 28 Oct 2020 14:08:04 -0700 Subject: [PATCH] window: maybe fix ghostly artifacts on macos Not 100% sure that this is it, but it seems much less likely that artifacts will appear in conjunction with transparency when the window shadow effect is disabled; I didn't see the ghosting with this disabled, but I sometimes dididn't see it with it enabled, so I'm not sure that we have a 100% reliable reproduction, and thus am not sure that this is a fix. I found mention of disabling the shadow in some example code on stackoverflow when I was first researching this, but it wasn't supplied with an explanation. Perhaps this is why? Longer term we might want to be smarter about turning off the shadow only when the opacity is != 1.0, but at the moment the window layer can't see the config, so let's just default it off for the moment until we see if it does the trick. refs: #310 --- window/src/os/macos/window.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 9bc4dab91..cfbc19d64 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -405,7 +405,10 @@ impl Window { window.setReleasedWhenClosed_(NO); window.setOpaque_(NO); - // window.setHasShadow_(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));