Skip to content

Add Windows desktop support and native host integration - #1

Open
wintergraham wants to merge 2 commits into
zeronsh:mainfrom
wintergraham:codex/windows-upstream
Open

wintergraham wants to merge 2 commits into
zeronsh:mainfrom
wintergraham:codex/windows-upstream

Conversation

@wintergraham

@wintergraham wintergraham commented Oct 3, 2026 •

Copy link
Copy Markdown

Windows currently lacks native dialog and activation implementations in the desktop host. This adds Windows desktop support using the existing winit, wgpu, arboard, AccessKit and rfd backends, plus the native host access needed to embed child views.

  • Parent Windows file pickers and prompts to their owning window, retain that window while the native dialog is open, and document cancellation behavior.
  • Expose deferred native-window access through FileDialogs::native_window() and WindowContext::native_window().
  • Add Application::run_with_pump() for foreign native message loops. On Windows it runs through winit's message hook outside application callbacks, avoiding nested-pump paint starvation. macOS uses a guarded default-mode timer.
  • Return an explicit error for unsupported Windows application activation; retain rendered application menus and Control shortcuts.
  • Add Windows to the CI matrix, extend the native lifecycle test, and provide a self-closing message-pump example.

This PR contains the two Windows/native-host commits only. The later Ask scrolling/accessibility optimizations and bounds-observation changes are excluded.

Validation

Passed locally on Windows/MSVC:

  • cargo fmt --all -- --check
  • cargo test -p zgui -p zgui-desktop --lib --locked
  • cargo test -p zgui-desktop --lib host_suspend_recreates_native_resources_and_retains_editor_state --locked -- --ignored --test-threads=1
  • cargo run -p zgui-desktop --example native_message_pump --locked (58 pump calls and orderly exit)
  • cargo clippy --workspace --all-targets --locked (completed with warnings)
  • cargo test --workspace --doc --locked (32 doctests passed)

Also passed: cargo check --workspace --lib --target aarch64-apple-darwin --locked from the Windows host. This is a cross-compilation check, not macOS runtime validation.

Strict cargo clippy --workspace --all-targets --locked -- -D warnings is blocked on Rust 1.98 by existing upstream warnings in unchanged benchmark/GPU/example code: manual_is_multiple_of, chunks_exact_to_as_chunks and for_unbounded_range. These files have no diff in this PR.

Windows dialog interaction, screen readers, cross-process clipboard, DPI transitions, and macOS runtime behavior still require separate native qualification.


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

@wintergraham
wintergraham marked this pull request as ready for review October 3, 2026 09:07
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