mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-04 07:13:21 +01:00
## Summary On macOS 27, `WindowBackgroundAppearance::Blurred` doesn't blur anything: the window is only transparent, so whatever is behind it shows through sharp. In Zed, this affects themes with `"background.appearance": "blurred"`. `BlurredView` is an `NSVisualEffectView` with the `Selection` material, and `blurred_view_update_layer` strips the material's tint and saturation so that only its backdrop blur remains. On macOS 27, `Selection` no longer has a `CABackdropLayer`, so there's no blur left to keep. This switches to `UnderWindowBackground`, which still has one, so the existing stripping leaves the same colorless blur as before. It also sets the behind-window blending mode explicitly (it's already the default). #64284 describes the same root cause, and #62605 proposed the same change; it was closed while waiting on the before/after screenshots requested there, which are below. A translucent window with `WindowBackgroundAppearance::Blurred` over a striped window, on macOS 27.0 (26A428): | Before (`main`) | After (this PR) | | --- | --- | | <img width="680" alt="Before: the stripes behind the translucent window are sharp" src="https://github.com/user-attachments/assets/5ec94418-7313-4595-bf29-6a6646454a24" /> | <img width="680" alt="After: the stripes behind the translucent window are blurred" src="https://github.com/user-attachments/assets/2901e570-8db9-4e1f-a152-fc8c1895e0c3" /> | <details> <summary>Example</summary> ```rust use std::rc::Rc; use gpui::{ AppContext as _, Application, Bounds, Context, IntoElement, Render, Window, WindowBackgroundAppearance, WindowBounds, WindowOptions, div, point, prelude::*, px, rgb, rgba, size, }; use gpui_macos::MacPlatform; struct Stripes; impl Render for Stripes { fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement { let colors = [0xff3b30, 0xffffff, 0x007aff, 0x000000]; div() .size_full() .flex() .children((0..60).map(move |i| div().w(px(24.)).h_full().bg(rgb(colors[i % 4])))) } } struct Translucent; impl Render for Translucent { fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement { div() .size_full() .flex() .items_center() .justify_center() .bg(rgba(0x0d0e1066)) .text_color(rgb(0xffffff)) .text_xl() .child("WindowBackgroundAppearance::Blurred") } } fn main() { Application::with_platform(Rc::new(MacPlatform::new(false))).run(|cx| { let bounds = |x, y, w, h| { Some(WindowBounds::Windowed(Bounds::new(point(px(x), px(y)), size(px(w), px(h))))) }; cx.open_window( WindowOptions { window_bounds: bounds(200., 200., 900., 560.), focus: false, ..Default::default() }, |_, cx| cx.new(|_| Stripes), ) .unwrap(); cx.open_window( WindowOptions { window_bounds: bounds(350., 300., 600., 340.), window_background: WindowBackgroundAppearance::Blurred, ..Default::default() }, |_, cx| cx.new(|_| Translucent), ) .unwrap(); cx.activate(true); }); } ``` </details> ## Testing - Ran the example above against `main` and against this branch on macOS 27.0 (26A428), Apple silicon: on `main` the stripes behind the window stay sharp; with this change they're blurred. - Inspected the `BlurredView`'s layers at runtime: with `Selection` there's no `CABackdropLayer`; with `UnderWindowBackground` there is one, and after the existing tint and saturation stripping only its `sdrNormalize` and `gaussianBlur` filters remain. - Not tested on macOS 26 or earlier. `UnderWindowBackground` is available from macOS 10.14. To check it, run the example on macOS 27, or use a Zed theme with `"background.appearance": "blurred"` and put a window with sharp detail behind Zed. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). Release Notes: - Fixed blurred window backgrounds not blurring on macOS 27. - [GPUI] Fixed windows with `WindowBackgroundAppearance::Blurred` being transparent but not blurred on macOS 27.