tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.59k stars 2.54k forks source link

[bug] Scaling Tauri webview window on windows 11 #11364

Open daedel opened 3 weeks ago

daedel commented 3 weeks ago

Describe the bug

On windows 11 Tauri webview window size is not the same as define in config.

Size in tauri config: 715x505 When I run app on my client's windows 11 pc, tauri window has size around 590x400. Looks like problem with scaling on that machine. When running app on windows 10 (different pc) its working good. On macos its working good. Im running on windows applicaiton builded on GH actions (target windows-latest)

Im not sure if thats the reason but found that there was a bug on windows webview2 -> https://github.com/MicrosoftEdge/WebView2Feedback/issues/1700

Currently my workaround for that is checking size on of react container and resizing window if size is less than definied in config.

I was trying:

Reproduction

Run application with window size 715x505 on windows 11.

Expected behavior

Tauri window should be the same as in tauri.config.json

Full tauri info output

[⚠] Environment
    - OS: Mac OS 14.3.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06) (Homebrew)
    ✔ cargo: 1.80.1
    ⚠ rustup: not installed!
      If you have rust installed some other way, we recommend uninstalling it
      then use rustup instead. Visit https://rustup.rs/
    ⚠ Rust toolchain: couldn't be detected!
      Maybe you don't have rustup installed? if so, Visit https://rustup.rs/
    - node: 20.10.0
    - pnpm: 9.1.1
    - yarn: 1.22.22
    - npm: 10.2.3

[-] Packages
    - tauri [RUST]: 1.6.6
    - tauri-build [RUST]: 1.5.2
    - wry [RUST]: 0.24.10
    - tao [RUST]: 0.16.9
    - @tauri-apps/api [NPM]: 1.5.6 (outdated, latest: 2.0.2)
    - @tauri-apps/cli [NPM]: 1.5.14 (outdated, latest: 1.6.3)

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

Discord support post: https://discord.com/channels/616186924390023171/1294718226109956160

ahqsoftwares commented 3 weeks ago

The issue seems to be fixed in the microsoft's part, so my wild guess is enabling GdiScaling in wry's part will fix the issue?