Skip to content

webview: render GPUI overlays above native WebView - #2626

Open
huacnlee wants to merge 14 commits into
mainfrom
webview-overlay
Open

webview: render GPUI overlays above native WebView#2626
huacnlee wants to merge 14 commits into
mainfrom
webview-overlay

Conversation

@huacnlee

@huacnlee huacnlee commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

  • enable GPUI's layered macOS scene when creating a wry WebView
  • render Dialog, Sheet, and Notification root layers in the deferred overlay plane
  • expand the WebView example to cover Popover, Dialog, Notification, and PopupMenu in an 800x600 window
  • keep native WebView focus ownership in gpui-wry, including stale-caret cleanup
  • install standard Edit-menu actions so AppKit routes clipboard shortcuts through the active responder
  • add an English platform-composition report and Windows CompositionController implementation handoff
  • depend directly on the companion GPUI branch in Cargo.toml

Depends on zed-industries/zed#61945

Current scope

The macOS visual stack, focus handoff, clipboard shortcuts, and modal/outside-click behavior are validated. While any top-plane primitive exists, the full transparent overlay view captures input; fine-grained pass-through regions remain part of the documented production native-surface portal design. Windows CompositionController and Linux hosting are documented follow-ups rather than claims of this PR.

Focus and clipboard ownership

gpui-wry owns the native focus boundary instead of adding WebView-specific behavior to GPUI. A lifecycle-scoped local NSEvent monitor native-hit-tests direct WKWebView clicks and clears GPUI logical focus. The existing GPUI mouse listener covers the overlay-active path, including dismissing a Popover by clicking the WebView region.

The example installs standard Edit-menu actions for Cut, Copy, Paste, and Select All. AppKit routes Cmd+C, Cmd+V, Cmd+X, and Cmd+A through the active WKWebView or GPUI responder.

Test Plan

  • cargo check -p gpui-wry -p webview
  • manually verify Popover, Dialog, Notification, and PopupMenu render above a live WKWebView
  • manually verify clicking WebView dismisses Popover
  • manually verify a direct WebView click clears the address Input focus indication and stale caret
  • manually copy from GPUI to WebView and from WebView to GPUI using Cmd+C and Cmd+V
  • git diff --check

Enable the layered GPUI scene on macOS, move root overlays into the deferred plane, expand the WebView example, and document the platform composition architecture.

Co-authored-by: Codex <codex@openai.com>
huacnlee and others added 6 commits July 30, 2026 22:08
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Keep WebView focus ownership in gpui-wry so GPUI only needs the scene overlay changes. Document the responder-chain requirements for clipboard shortcuts.

Co-authored-by: Codex <codex@openai.com>
Build Windows WebViews with the wry composition controller and synchronize the GPUI native-surface portal bounds. Keep the existing macOS path unchanged.

Co-authored-by: Codex <codex@openai.com>
@huacnlee

Copy link
Copy Markdown
Member Author

Windows implementation checkpoint: 4e560a95 now creates a GPUI native-surface portal, passes its IDCompositionVisual to the wry CompositionController, and synchronizes device-pixel bounds. Dependencies: huacnlee/zed#24 at deafa650ce and longbridge/wry:gpui-composition-controller at 2d0b3e2. Native Windows compilation/runtime validation is required next. Pointer/focus/IME forwarding and device-loss rebinding remain incomplete.

huacnlee and others added 3 commits July 30, 2026 23:38
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
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.

1 participant