XWayland: Erratic mouse behavior with Wine/World of Warcraft due to warp emulation
After switching from i3 to swaywm, World of Warcraft under Wine got a weird behavior : clicking almost anywhere in the window (except things like buttons) would move the mouse pointer to the center of the screen.
After digging a bit I was able to reproduce the issue. Schematically, the game is doing something close to this :
OnMouseButtonPressed(): HideCursor() SaveCurrentCoordinates() WarpToWindowCenter() OnMouseButtonRelease() ShowCursor() WarpToSavedCoordinates()
I have attached a X program that reproduces the issue : warp_test.c
The root of the issue is that XWarpPointer() in XWayland only works when the mouse is hidden. Allowing XWarpPointer() when the mouse is visible, as illustrated in always-warp.diff, fixes the issue.