Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui_macos: Fix blurred window backgrounds on macOS 27 (#65361)
Ben Williams90d851405956
diff --git a/crates/gpui_macos/src/window.rs b/crates/gpui_macos/src/window.rsindex 0a4027b8777..b04282552d0 100644--- a/crates/gpui_macos/src/window.rs+++ b/crates/gpui_macos/src/window.rs@@ -11,9 +11,10 @@ use cocoa::{appkit::{NSApplication, NSBackingStoreBuffered, NSColor, NSEvent, NSEventModifierFlags, NSEventType,NSFilenamesPboardType, NSPasteboard, NSRequestUserAttentionType, NSScreen, NSView,- NSViewHeightSizable, NSViewWidthSizable, NSVisualEffectMaterial, NSVisualEffectState,- NSVisualEffectView, NSWindow, NSWindowCollectionBehavior, NSWindowOcclusionState,- NSWindowOrderingMode, NSWindowStyleMask, NSWindowTitleVisibility,+ NSViewHeightSizable, NSViewWidthSizable, NSVisualEffectBlendingMode,+ NSVisualEffectMaterial, NSVisualEffectState, NSVisualEffectView, NSWindow,+ NSWindowCollectionBehavior, NSWindowOcclusionState, NSWindowOrderingMode,+ NSWindowStyleMask, NSWindowTitleVisibility,},base::{id, nil},foundation::{@@ -3805,9 +3806,13 @@ fn display_id_for_screen(screen: id) -> Option<CGDirectDisplayID> {extern "C" fn blurred_view_init_with_frame(this: &Object, _: Sel, frame: NSRect) -> id {unsafe {let view = msg_send![super(this, class!(NSVisualEffectView)), initWithFrame: frame];- // Use a colorless semantic material. The default value `AppearanceBased`, though not- // manually set, is deprecated.- NSVisualEffectView::setMaterial_(view, NSVisualEffectMaterial::Selection);+ // A window-background material, whose tint and extra saturation+ // `blurred_view_update_layer` strips, leaving only the blur. `Selection`, used before,+ // has no `CABackdropLayer` on macOS 27, so nothing behind the window was blurred. (Setting+ // a material also avoids the deprecated default, `AppearanceBased`.)+ NSVisualEffectView::setMaterial_(view, NSVisualEffectMaterial::UnderWindowBackground);+ // The default, but blurring what's behind the window is this view's whole purpose.+ NSVisualEffectView::setBlendingMode_(view, NSVisualEffectBlendingMode::BehindWindow);NSVisualEffectView::setState_(view, NSVisualEffectState::Active);view}