tao icon indicating copy to clipboard operation
tao copied to clipboard

WebviewWindow doesn't adhere to x,y on Mac

Open someone2080 opened this issue 1 year ago • 2 comments

Describe the bug Bug is very similar to 11430

Reproduction

When I try to create a new window using WebviewWindow with x,y options, the newly created Window appears on the Display, based on the x,y coordinates, but then jumps to the primary Display. I have to use setPosition method to move it to the right Display.

This behavior can be fixed with setPosition, ex: await webview.setPosition(position), but the workaround won't work if the screens have different scale/ratio, see image:

Screenshot 2024-12-08 at 4 27 20 PM Screenshot 2024-12-08 at 4 28 16 PM

someone2080 avatar Dec 08 '24 23:12 someone2080

Hey guys, are there any updates on this one? This is a regression from Tauri 1. I wish I could fix it myself, but I'm still learning Rust...

someone2080 avatar Mar 13 '25 08:03 someone2080

For anyone else having the same issue: It looks like on macOS, WebviewWindow.setPosition accepts LogicalPosition instead of PhysicalPosition. If, for example, you get your coords from Monitor, which provides PhysicalPosition on both Mac and Windows, you will need to convert this PhysicalPosition to LogicalPosition.

Similar issue here #1057

someone2080 avatar Apr 07 '25 04:04 someone2080