Skip to content

fix(desktop): keep WebView2 scale correct after restore / 修复 Windows 混合 DPI 恢复缩放 - #6472

Merged
SivanCola merged 2 commits into
esengine:main-v2from
SivanCola:fix/windows-mixed-dpi-restore
Jul 14, 2026
Merged

fix(desktop): keep WebView2 scale correct after restore / 修复 Windows 混合 DPI 恢复缩放#6472
SivanCola merged 2 commits into
esengine:main-v2from
SivanCola:fix/windows-mixed-dpi-restore

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

Summary

  • Closes [Bug]: 窗口最小化后恢复强制全屏缩放,画面模糊 #5862.
  • Keep WebView2 monitor-scale detection enabled while Wails v2 uses raw-pixel bounds, so Windows frameless windows cannot retain another monitor's DPI after minimise/restore.
  • Carry the minimal Wails v2 WebView2 packages locally from go-webview2 v1.0.23, with the upstream source, license, patch rationale, and removal condition documented.
  • Add contract coverage that verifies both the local module replacement and the enabled monitor-scale policy.

Root cause: Windows temporarily parks minimized windows off-screen. On mixed-DPI desktops this can associate the frameless window with another monitor, while Wails v2 suppresses the minimize-time WebView resize and disables WebView2's automatic monitor-scale detection. The stale rasterization scale and bounds then survive restore until another resize occurs.

This follows the upstream Wails diagnosis in wailsapp/wails#5544 and the monitor-scale ownership fix in wailsapp/wails#5734 without removing Reasonix's Windows frameless chrome.

Verification

  • cd desktop && go test ./...
  • cd desktop && wails generate module (no generated diff)
  • cd desktop/third_party/go-webview2 && GOOS=windows GOARCH=amd64 go test -exec=true ./pkg/edge
  • cd desktop/third_party/go-webview2 && GOOS=windows GOARCH=arm64 go test -exec=true ./pkg/edge
  • cd desktop && GOOS=windows GOARCH=amd64 go build -trimpath .
  • cd desktop && GOOS=windows GOARCH=arm64 go build -trimpath .
  • Both Windows binaries report github.com/wailsapp/go-webview2 => ./third_party/go-webview2 in their Go build metadata.
  • ./scripts/cache-guard.sh

Physical mixed-DPI Windows hardware was not available locally. The policy matches the upstream fix verified for the same minimize/restore DPI failure mode.

Compatibility

Field / contract Old-data behavior Conclusion
Desktop window state Existing geometry and maximized-state files are read unchanged Compatible
User config and session data No persisted fields or formats changed Compatible
Wails JS bindings Regeneration produced no diff Compatible
Windows WebView2 runtime Only monitor-scale ownership changes; framed and single-DPI behavior keep the WebView2 default Compatible

Cache impact

Cache-impact: none - the change is limited to Windows desktop WebView2 initialization and does not affect provider-visible prompts, tool schemas, ordering, or request serialization.
Cache-guard: ./scripts/cache-guard.sh passed all release cache-hit cases.
System-prompt-review: N/A

@SivanCola
SivanCola requested a review from esengine as a code owner July 14, 2026 11:23
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 窗口最小化后恢复强制全屏缩放,画面模糊

1 participant