tauri-apps / tauri

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

[bug] outerPosition/outerSize return inaccurate dimensions for WebviewWindow #11565

Closed dgerhardt closed 3 weeks ago

dgerhardt commented 3 weeks ago

Describe the bug

The outerPosition/outerSize methods of WebviewWindow (I've only tested the JS API) return inaccurate values for y on Linux/X11 and height on Windows.

In both cases the deviation seems to be around the size of the title bar.

Reproduction

  1. Retrieve the WebviewWindow's dimensions using outerPosition and outerSize JS API methods.
  2. Update the WebviewWindow's dimensions using setPosition and setSize JS API methods.
  3. Retrieve the WebviewWindow's dimensions again.

Observed behavior: The WebviewWindows y (Linux) or height (Windows) values returned are larger than expected.

Reproduction repository: https://github.com/dgerhardt/tauri-app-inaccurate-outer-dimensions

Expected behavior

outerPosition and outerSize should return accurate dimensions of the window.

Full tauri info output

[✔] Environment
    - OS: Ubuntu 24.4.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.44.0
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.18.0
    - yarn: 1.22.19
    - npm: 10.8.2

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - @tauri-apps/api : 2.0.3
    - @tauri-apps/cli : 2.0.5

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Vite

Stack trace

No response

Additional context

Related issue: #11510

dgerhardt commented 3 weeks ago

Closing for now. I'll wait for https://github.com/tauri-apps/tao/pull/1001 to be merged and will reopen if the issue on Windows remains.