Skip to content

feat(window): add opt-in ResizeSync (Auto, On, Off) builder on App and WindowSpec - #2319

Merged
Hona merged 1 commit into
devfrom
feat/2113-public-resize-sync-switch
Nov 25, 2026
Merged

Hona merged 1 commit into
devfrom
feat/2113-public-resize-sync-switch

Conversation

@Hona

@Hona Hona commented Nov 25, 2026

Copy link
Copy Markdown
Member

Refs #2113

Adds the strictly additive per-window ResizeSync policy (Auto, On, Off) on App and WindowSpec while keeping the Windows drag-only synchronized resize path off by default (ResizeSync::Auto resolves to off today).

Public API

use rune::{App, AppSpec, ResizeSync, el};

App::new(AppSpec::new("Settings", (620.0, 520.0), || (), |_, _| el()))
    .resize_sync(ResizeSync::On)
    .run();
  • #[non_exhaustive] pub enum ResizeSync { #[default] Auto, On, Off } in crates/rune/src/window/resize_sync.rs, re-exported from window.rs and lib.rs (mirrors CpuFirst).
  • App::resize_sync(self, mode: ResizeSync) -> Self and forwarded WindowSpec::resize_sync(self, mode: ResizeSync) -> Self (no pub field on literal structs, no WindowsWindowOptions knob, no Cx reader).
  • Renamed the internal Win32 struct in crates/rune/src/window/win32/resize_sync.rs to DragResizeSync so it does not shadow rune::ResizeSync.

Resolution & kill switch

  • Replaced the process-wide OnceLock<bool> with per-window resolution on Host (Host::resize_sync_enabled), so multi-window apps can opt individual windows in or out independently.
  • RUNE_RESIZE_SYNC overrides every window without a rebuild:
    • 1, true, yes, on (ASCII case-insensitive) → ResizeSync::On
    • 0, false, no, off → ResizeSync::Off (unconditional kill switch over ResizeSync::On)
    • auto → ResizeSync::Auto (off today; may promote to on in a later release once more GPU/OS configurations are verified)
    • unset, empty, or unrecognized → leaves each window's builder value intact.
  • Ignored on macOS, Linux, web, iOS, headless runs, overlays, transparent windows (including WindowBackdrop and El::system_material), WGPU_DX12_PRESENTATION_SYSTEM=hwnd, software/WARP adapters, non-8-bit/HDR formats, and CPU/handover/rebinding states.
  • When effective mode is off (Auto today or Off), zero D3D11 devices, shared textures, second swap chains, or extra Handover objects are created.

Docs, example & changelog

  • Compiled no_run rustdoc on ResizeSync, App::resize_sync, and WindowSpec::resize_sync documenting the path, hybrid-GPU bitblt and post-drag D3D11 device (~15–40 MiB) costs, and the accepted ~5% occasional late-step limit at 239 Hz (citing Microsoft Learn For best performance, use DXGI flip model, DXGI_SWAP_EFFECT, DXGI_SCALING, WM_NCCALCSIZE, and IDCompositionTarget::SetRoot; undocumented interfaces declined).
  • Updated crates/rune/README.md beside CpuFirst.
  • Added --resize-sync (on/off/auto) CLI flag to examples/settings/src/main.rs (cargo run --release -p settings -- --resize-sync).
  • Added changelog/unreleased/2026-11-26-public-resize-sync-switch.md.

@Hona
Hona merged commit 6d566c1 into dev Nov 25, 2026
1 check passed
@Hona
Hona deleted the feat/2113-public-resize-sync-switch branch November 25, 2026 14:45
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