tauri-apps / tauri

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

[bug] Incorrect DPI scaling on Wayland/Linux #5600

Open happenslol opened 1 year ago

happenslol commented 1 year ago

Describe the bug

Running a freshly initialized tauri project on a 2256x1504 Laptop produces the following window when running yarn tauri dev:

2022-11-09_21-34_1

Opening the URL of the local dev server in chrome with the ozone platform enabled shows the following:

2022-11-09_21-34

It seems like the webview is not doing any scaling at all. Setting GDK_SCALE or GDK_DPI_SCALE does not have any effect either.

Reproduction

  1. Run cargo-create-tauri-app
  2. Run yarn tauri dev on a HiDPI-screen

Expected behavior

The scaling should be the same in the GTK WebView as in a correctly scaled Chromium or Firefox window.

Platform and versions

Running on NixOS with Sway/Wayland and scaling set to 1.5, using the recommended flake.nix.

$ tauri info

Environment
  › OS: NixOS 22.11.0 X64
  › Node.js: 18.9.1
  › npm: 8.19.1
  › pnpm: Not installed!
  › yarn: 1.22.19
  › rustup: 1.25.1
  › rustc: 1.64.0
  › cargo: 1.64.0
  › Rust toolchain: stable-x86_64-unknown-linux-gnu

Packages
  › @tauri-apps/cli [NPM]: 1.2.0
  › @tauri-apps/api [NPM]: 1.2.0
  › tauri [RUST]: 1.2.0,
  › tauri-build [RUST]: 1.2.0,
  › tao [RUST]: 0.15.3,
  › wry [RUST]: 0.22.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:1420/
  › framework: React

App directory structure
  ├─ public
  ├─ node_modules
  ├─ src-tauri
  ├─ .vscode
  ├─ .direnv
  └─ src

Stack trace

No response

Additional context

No response

happenslol commented 1 year ago

Does anyone have any input on this? Is this maybe a better fit for another tauri-apps repository, since it deals more directly with the windowing/webkit2gtk layer? I'd also be open to digging into this if anyone could point me in the right direction.

I'd really love to use tauri for a project of mine, but this is really standing in the way of that.

wusyong commented 1 year ago

Is website with any URL link also affected? I've auto scaled the gtk window iirc. Search a bit on webkit2gtk and I found it might need to do it manually. I can test this in wry if there's a minimum example to reproduce.

elibroftw commented 8 months ago

image

User has 200% scaling, cannot scroll