Skip to content

Add a native-content overlay plane on Windows - #15

Merged
wingleeio merged 2 commits into
zeronsh:mainfrom
Master0fFate:windows-scene-overlay
Oct 8, 2026
Merged

wingleeio merged 2 commits into
zeronsh:mainfrom
Master0fFate:windows-scene-overlay

Conversation

@Master0fFate

@Master0fFate Master0fFate commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Windows now implements enable_scene_overlay and draw_layered. Deferred content (menus, tooltips, prompts) draws into a second composition swap chain above a native layer, so embedded surfaces like WebView2 sit between the base UI and the overlays. Frames with nothing deferred skip the overlay entirely.

Also adds Window::native_composition to expose the DirectComposition device and layer, and moves keyboard focus back from native children when GPUI content is pressed. Overlay backdrop blurs sample the base frame, so frosted popovers still blur the UI beneath them.

Used by Zeron's Windows browser (WebView2 in visual-hosting mode).

Tested with cargo test -p gpui_windows --lib and in Zeron on Windows 10.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Windows now implements enable_scene_overlay and draw_layered. Deferred content
(menus, tooltips, prompts) draws into a second composition swap chain above a
native layer, so embedded surfaces like WebView2 sit between the base UI and
the overlays. Frames with nothing deferred skip the overlay entirely.

Also adds Window::native_composition to expose the DirectComposition device and
layer, and moves keyboard focus back from native children when GPUI content is
pressed.
Recovery decided whether to re-enable the overlay from the overlay
itself, which an earlier failed retry had already dropped, so a retried
recovery silently lost it (and the embedded WebView with it). Track the
request instead and fail the attempt if re-enabling fails, so the retry
loop covers it. NativeComposition handles are released on device loss;
document that they are valid only for one generation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@wingleeio wingleeio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Security-audited (no new deps, network, file/process access; core changes additive with no-op defaults off Windows) and reviewed. Pushed 9136322: device-lost recovery now restores the overlay from a persistent request flag (a retried recovery previously dropped it for good) and NativeComposition docs state handles are valid per generation. Renderer tests green. Follow-up worth considering: the overlay duplicates the per-window path/MSAA intermediates (~260 MB at 4K) — the two planes draw sequentially and could share them.

@wingleeio
wingleeio merged commit dce5c1f into zeronsh:main Oct 8, 2026
1 check passed
@Master0fFate
Master0fFate deleted the windows-scene-overlay branch October 8, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants