Vadoola / Tomotroid

Simple Pomodoro Timer made with Rust + Slint. Design shamelessly ripped from Pomotroid
MIT License
38 stars 8 forks source link

Window Movment on Linux #20

Closed Vadoola closed 1 year ago

Vadoola commented 1 year ago

It looks like I can't move the Window around on Linux. Running on an Arch VM with Wayland

Vadoola commented 1 year ago

So I don't know all the details, but this appears to be a Wayland issue. I installed a handful of other desktop environments on my Arch VM, include Mate, XFCE, and also tested it on Gnome using X11 instead of Wayland. On X11 I can move the Window around just fine, but on Wayland it won't move.

I wanted to try and test this under KDE in Wayland, but for some reason I'm getting errors about invalid signing keys for most of the KDE packages on Arch. I tried a handful of things to resolve it but none were working.

Vadoola commented 1 year ago

So this appears to be an issue when I started using the i_slint_backend_winit private api crate so I could hide the window when "minimizing" to the tray, and to programmatically minimize the window from the minimize button.

On Windows and X11 the i_slint_backend_winit, seems to work fine. However on Wayland, I loose the ability to move the window for some reason with winit. If I switch to using i_slint_backend_qt instead of Winit, I loose the HiDPI scaling it seems, but I can now move the Window around on Wayland.

So something about using Winit on Wayland is causing an issue here.

I quickly tried to use the Qt backend on Windows and got a panic saying slint was compiled without Qt Support...strange since I'm pretty sure I've run other programs (not this one) on the same machine specifically with the Qt backend. I quickly did a cargo clean and recompiled in case some strange issue occurred with build artifacts, but got the same panic... Not sure what's going on there but I'll have to dig more into it later.

I wonder if a hacky temporary solution is some os specific config, on Linux I use Qt and on Windows I use winit....

Vadoola commented 1 year ago

https://github.com/slint-ui/slint/issues/3032

https://github.com/rust-windowing/winit/discussions/2920

It looks like I will either need to put in some cfg guards, basically use my existing logic, except on Winit Wayland do something else. Or force the winit background always and look into this drag_window method winit has. I'm not sure though if switching purely to winit and using this drag_window will have other consequences though...I'm currently leaning towards this instead of a whole bunch of cfg guards and trying to catch every possible edge case.

Vadoola commented 1 year ago

The movement logic has been updated to use winit::drag_window() and it seems to work across platform. This was fixed in commit 8c99939