tauri: [bug] Can't move or resize the main window
Describe the bug
I can’t move or resize a window after upgrading to tauri latest rc (2.0.0-rc.3 at that time) when running as dev.
The thing is it doesn’t come from that tauri version as downgrading it doesn’t solve the problem.
Reproduction
-
Create a minimal tauri app using the latest release candidate.
cargo create-tauri-app --rc -
Run the app in dev mode.
cargo tauri dev
Expected behavior
Be able to move or resize the application’s window.
Full tauri info output
WARNING: no lock files found, defaulting to npm
[✔] Environment
- OS: Fedora 40.0.0 X64
✔ webkit2gtk-4.1: 2.44.2
✔ rsvg2: 2.57.1
✔ rustc: 1.79.0 (129f3b996 2024-06-10)
✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
- node: 22.6.0
- npm: 10.8.1
- bun: 1.1.24
[-] Packages
- tauri [RUST]: 2.0.0-rc (no lockfile)
- tauri-build [RUST]: no manifest (no lockfile)
- wry [RUST]: no manifest (no lockfile)
- tao [RUST]: no manifest (no lockfile)
- tauri-cli [RUST]: 2.0.0-rc.3
- @tauri-apps/api : not installed!
- @tauri-apps/cli [NPM]: 2.0.0-rc.3
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../src
Stack trace
No response
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 33 (10 by maintainers)
Commits related to this issue
- fix(app): Workaround for GNOME/Wayland resize bug. * Force X11 backend on GNOME + Wayland to work around a Tauri/WRY bug: https://github.com/tauri-apps/tauri/issues/10686 — committed to zmkfirmware/zmk-studio by petejohanson 2 years ago
- fix(app): Workaround for GNOME/Wayland resize bug. * Force X11 backend on GNOME + Wayland to work around a Tauri/WRY bug: https://github.com/tauri-apps/tauri/issues/10686 — committed to zmkfirmware/zmk-studio by petejohanson 2 years ago
It also happens in release mode. For some reason this is specific for Gnome + Wayland
KDE + X11 -> Can resize and move KDE + Wayland -> Can resize and move GNOME + X11 -> Can resize and move GNOME + Wayland -> The issue appears.
following on hint by @ndom91, I found out that reversing changes of fix(linux): prevent firing duplicate mouse events in tao fixes move/size issue, but brings back duplicate mouse events.
using xprop method of detecting if application is running native wayland or thru xwayland (shows crosshair on xwayland and no cursor change on wayland). I have found out:
This suggests that the problem is in tauri/tao/wry and not in the system.
My current workaround is setting env var “GDK_BACKEND” to x11 at top of the main() function.
p.s. beware of running your app from vs code terminal as it sets GDK_BACKEND to x11
Closed by https://github.com/tauri-apps/tao/pull/979, if the issue happens after release, please let me know
The issue might come from
tauri-runtime-wry. I’ve found that adding it to theCargo.tomlto set it to its last version (2.0.0-rc.6) brings the bug.Also, both minimize and close buttons work and I can move the window when “dragging” them.
I’ve gone through and tried all
tauri-runtime-wryversions fromrc.8back down torc.2and it seems that it really has broken inrc.3, that was the first release where my app also began experiencing these issues in wayland+gnome DE’sI found the root cause of this issue when troubleshooting the issue https://github.com/tauri-apps/tao/issues/929. Adding a comment here for future reference.
It turns out to be an issue of the GTK or Wayland under certain scenarios.
By tracking the history, I found that this issue was introduced by #941, which is trying to fix the duplicated mouse event triggered by a single click on Linux. The solution in this PR is to prevent the related event from being propagated.
Since the issue is Wayland-specific. I reproduced this issue with a minimal GTK app using the
gtk-rscrate.On Wayland, running the above code directly will cause the window to not move. If you run the code with
GDK_BACKEND=x11(i.e., XWayland is used) or on X11, the window can move.The reason is that clicking on the window title bar will trigger a button press event on Wayland, and the
connect_button_press_eventcallback stops the event. So the window cannot move. However, on XWayland or X11, clicking on the window title bar will not trigger a button press event, so the window can move.So, this could be a bug in GTK or Wayland. I have reported it at: https://gitlab.gnome.org/GNOME/gtk/-/issues/7327
BTW, using
GDK_BACKEND=x11will use XWayland on the Wayland environment. If you enable Tauri’s tray icon, this will cause the two system tray icons (one is active, another is dead) problem.@amrbashir i tested the new release and that’s not really a solution. The custom header has 2 serious problems:
Please, reopen this bug report until a proper fix is implemented.
@Khalid-Nowaf I have implemented a header for Wayland, and it will be included in the next version once https://github.com/tauri-apps/tao/pull/982 is released.