gpui/mac: Disable shadows on non-opaque windows (#10896)

The culprit behind ghost images in transparent windows and bad
performance with blurred windows turns out to be one and the same:
window shadows. The simplest and most popular fix appears to be to
simply disable shadows on non-opaque windows so let's just do that.

Disabling shadows on a window that is already visible however leaves the
shadow on screen, detached from the window, until a full screen effect
such as exposé or a virtual desktop switch wipes it clean. There does
not seem to be any known solution to this, and it does not affect
windows created after switching to a transparent theme so this is a good
enough compromise for now.



Release Notes:

- Fixed ghostly artifacts in transparent window backgrounds.
- Fixed sluggishness with blurred window backgrounds.
This commit is contained in:
jansol 2024-04-29 18:04:11 +03:00 committed by GitHub
parent 5ef75919f0
commit 35c3af7fd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -996,6 +996,8 @@ impl PlatformWindow for MacWindow {
};
unsafe {
this.native_window.setOpaque_(opaque);
// Shadows for transparent windows cause artifacts and performance issues
this.native_window.setHasShadow_(opaque);
let clear_color = if opaque == YES {
NSColor::colorWithSRGBRed_green_blue_alpha_(nil, 0f64, 0f64, 0f64, 1f64)
} else {