Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] window size is not correct since v2.1.1 #12152

Open
zhangsan946 opened this issue Jan 3, 2025 · 0 comments
Open

[bug] window size is not correct since v2.1.1 #12152

zhangsan946 opened this issue Jan 3, 2025 · 0 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@zhangsan946
Copy link

zhangsan946 commented Jan 3, 2025

Describe the bug

While creating the main WebviewWindow with the following snippet, it works well on Windows.

let main_window = tauri::WebviewWindowBuilder::new(
      app_handle,
      "main",
      tauri::WebviewUrl::default(),
  )
  .fullscreen(false)
  .maximizable(false)
  .resizable(false)
  .visible(false)
  .title(app_handle.package_info().name.as_str())
  .position(0., 0.)
  .inner_size(330., 620.)
  .build()?;

let window_size = main_window.outer_size()?;

But on Linux(ubuntu 22.04), main_window.outer_size() returns (0,0). After some debug, it shows to be releted with visible config. It seems not to be able to get the window outer size before the window shows. It used to work before tauri v2.1.1.

On MacOS, the inner_size would include the height of window title bar which differs from Windows and Linux behavior. I remember that the inner_size behaves the same on these three OS some time ago.

Reproduction

Please refer to the description section.

Expected behavior

No response

Full tauri info output

Linux:

[✔] Environment
    - OS: Ubuntu 22.4.0 x86_64 (X64) (ubuntu on x11)
    ✔ webkit2gtk-4.1: 2.46.4
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.10.0
    - yarn: 1.22.21
    - npm: 10.2.3

[-] Packages
    - tauri 🦀: 2.2.0
    - tauri-build 🦀: 2.0.4
    - wry 🦀: 0.48.0
    - tao 🦀: 0.31.0
    - tauri-cli 🦀: 1.3.1
    - @tauri-apps/api : 2.2.0
    - @tauri-apps/cli : 2.2.0

[-] Plugins
    - tauri-plugin-autostart 🦀: 2.2.0
    - @tauri-apps/plugin-autostart : 2.2.0
    - tauri-plugin-log 🦀: 2.2.0
    - @tauri-apps/plugin-log : 2.2.0
    - tauri-plugin-shell 🦀: 2.2.0
    - @tauri-apps/plugin-shell : 2.2.0
    - tauri-plugin-os 🦀: 2.2.0
    - @tauri-apps/plugin-os : 2.2.0
    - tauri-plugin-cli 🦀: 2.2.0
    - @tauri-apps/plugin-cli : not installed!
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : 2.2.0
    - tauri-plugin-http 🦀: 1.0.0
    - @tauri-apps/plugin-http : not installed!
    - tauri-plugin-single-instance 🦀: 2.2.0
    - @tauri-apps/plugin-single-instance : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - framework: Vue.js
    - bundler: Vite

MacOS:

[✔] Environment
    - OS: Mac OS 10.15.7 x86_64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 20.10.0
    - yarn: 1.22.4
    - npm: 10.2.3


### Stack trace

_No response_

### Additional context

_No response_
@zhangsan946 zhangsan946 added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 3, 2025
@zhangsan946 zhangsan946 changed the title [bug] window size issue [bug] window size is not correct since v2.1.1 Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

1 participant