Skip to content

macOS: backport public window blur to 0.30.x - #4832

Open
zoujiaqing wants to merge 2 commits into
rust-windowing:v0.30.xfrom
gearui:main
Open

zoujiaqing wants to merge 2 commits into
rust-windowing:v0.30.xfrom
gearui:main

Conversation

@zoujiaqing

Copy link
Copy Markdown

Summary

Backport the macOS window-blur fix from #4541 and 97fb66b to v0.30.x. The default 0.30.13 build references private WindowServer symbols even if the application never enables blur. This can cause Mac App Store rejection under guideline 2.5.1.

The default uses a public NSVisualEffectView behind the rendering view. The existing raw window handle continues to point at that rendering view when blur is toggled. The private-apple-apis feature retains the previous fixed-radius blur for applications that explicitly opt in. This backport does not add the 0.31 material-selection API.

Verification

  • cargo test on arm64 macOS: 37 passed, 4 doctests ignored.
  • Created windows with blur initially on and off; toggled it repeatedly and verified that the AppKit effect view is added/removed and the raw rendering view stays attached and unchanged.
  • nm -u shows neither CGS import by default; the legacy feature build imports both.
  • Added a changelog entry and documented the feature and the macOS behavior.

Adapt upstream 0ea5f3c and 97fb66b to the 0.30 AppKit bindings. Keep the previous blur opt-in and omit the new material-selection API from the stable backport.
@zoujiaqing
zoujiaqing requested a review from madsmtm as a code owner November 11, 2026 07:06
@elgeffe

elgeffe commented Nov 16, 2026

Copy link
Copy Markdown

Another data point for this backport: a Mac App Store submission built with winit 0.30.12 (through eframe/egui 0.31, which is still on winit 0.30) was rejected this week by App Review's automated scan for _CGSSetWindowBackgroundBlurRadius. The app never calls set_blur. We're carrying a vendored [patch.crates-io] copy of 0.30.12 in the meantime, so a 0.30.14 with this change would let downstream apps on the 0.30 line drop their patches.

Related: the undocumented NSCursor selectors and the _wantsKeyDownForEvent: override are also still ungated (on master too); filing that separately.

@elgeffe elgeffe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: since this targets a patch release, could the wrapper content view be created lazily, the first time blur is enabled? Right now every window gets the extra NSView as its contentView, even in apps that never blur. Winit itself handles that (the view ivar, rwh still points at WinitView), but outside code that reads window.contentView() and expects the winit view would see a change, e.g. accesskit_macos::SubclassingAdapter::for_window. Creating it on demand would keep the view hierarchy identical for everyone who doesn't use blur.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants