fix: cannot resize in wayland
Wayland won't give global cursor positions and window positions to applications.
However, Qt under Wayland won't report any errors when invoking related functions, instead, they just give some dummy values. The geometry()
is also somehow broken on Wayland.
The pos()
's return value won't change in Wayland, thus localCursorPos
calculation is wrong.
Before: there is a fixed gap because pos()
's value won't change.
After:
On my machine (arch), mapFromGlobal(QCursor::pos())
also works on X11.
There is a comment that comes from 5 years ago, and I don't know why it doesn't work before. To avoid breakage on someone else's machine, I don't want to change it.
Edited by shenleban tongying