-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Describe the bug
When moving a window from a HiDPI screen to a standard/lower DPI screen on Windows 11, the logical size of the window increases. When moving it from the HighDPI screen to the standard/lower DPI screen, the logical size reduces. There are additional side effects like the window jumping away from the cursor. This can quickly get out of hand and lead to an extremely large window which makes the Webview unresponsive.
If resizing is disabled for the window, the user has no way to reset the size.
The following video demonstrates the issue. It only shows the primary, HiDPI screen.
2025-02-05-124637_tauri-onscalechange-bug-windows.mp4
Reproduction
- Perform these steps on Windows 11.
- Set display scaling on the primary screen to 250 % and 100% on the second screen. Position the second screen on the left side of the primary screen. The latter made the issue to occur more consistently for me.
- Create the Tauri example app using the CLI.
- Run the app.
- Move the window between screens with different scaling multiple times.
Expected behavior
Windows should keep their logical size when moving them between screens with different scaling. Only the physical size should change.
Full tauri info output
[✔] Environment
- OS: Windows 10.0.26100 x86_64 (X64)
✔ WebView2: 132.0.2957.140
✔ MSVC: Visual Studio Build Tools 2022
✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 22.11.0
- pnpm: 9.13.2
- npm: 10.9.0
[-] Packages
- tauri 🦀: 2.2.5
- tauri-build 🦀: 2.0.5
- wry 🦀: 0.48.1
- tao 🦀: 0.31.1
- @tauri-apps/api : 2.2.0
- @tauri-apps/cli : 2.2.7
[-] Plugins
- tauri-plugin-log 🦀: 2.2.1
- @tauri-apps/plugin-log : 2.2.1
- tauri-plugin-opener 🦀: 2.2.5
- @tauri-apps/plugin-opener : 2.2.5
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- bundler: Vite
Stack trace
Additional context
Log of relevant window events of the application run during the video:
[2025-02-05][11:45:57][webview:[...]][INFO] onScaleChanged({"event":"tauri://scale-change","payload":{"scaleFactor":1,"size":{"width":800,"height":600}},"id":1})
[2025-02-05][11:45:57][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":800,"height":600},"id":0})
[2025-02-05][11:45:57][webview:[...]][INFO] onScaleChanged({"event":"tauri://scale-change","payload":{"scaleFactor":2.5,"size":{"width":2000,"height":1500}},"id":1})
[2025-02-05][11:45:57][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":2000,"height":1500},"id":0})
[2025-02-05][11:45:57][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":5048,"height":3882},"id":0})
[2025-02-05][11:46:08][webview:[...]][INFO] onScaleChanged({"event":"tauri://scale-change","payload":{"scaleFactor":1,"size":{"width":2019,"height":1553}},"id":1})
[2025-02-05][11:46:08][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":2019,"height":1553},"id":0})
[2025-02-05][11:46:08][webview:[...]][INFO] onScaleChanged({"event":"tauri://scale-change","payload":{"scaleFactor":2.5,"size":{"width":5048,"height":3883}},"id":1})
[2025-02-05][11:46:08][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":5048,"height":3883},"id":0})
[2025-02-05][11:46:08][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":12668,"height":9840},"id":0})
[2025-02-05][11:46:27][webview:[...]][INFO] onScaleChanged({"event":"tauri://scale-change","payload":{"scaleFactor":1,"size":{"width":5067,"height":3936}},"id":1})
[2025-02-05][11:46:27][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":5067,"height":3936},"id":0})
[2025-02-05][11:46:27][webview:[...]][INFO] onScaleChanged({"event":"tauri://scale-change","payload":{"scaleFactor":2.5,"size":{"width":12668,"height":9840}},"id":1})
[2025-02-05][11:46:27][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":12668,"height":9840},"id":0})
[2025-02-05][11:46:27][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":31718,"height":24732},"id":0})
[2025-02-05][11:48:12][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":0,"height":0},"id":0})
[2025-02-05][11:48:13][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":31718,"height":24732},"id":0})
[2025-02-05][11:48:16][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":0,"height":0},"id":0})
[2025-02-05][11:48:16][webview:[...]][INFO] onResized({"event":"tauri://resize","payload":{"width":31718,"height":24732},"id":0})