On Fri Feb 28 12:09:09 2025 +0000, Attila Fidan wrote:
I also patched xwayland on my machine to allow it when visible for winex11, since I think it's a nice feature. I think going against the intended use by the protocol in this particular case is ok, and SDL also does this for `WarpMouse*`, except it may instead treat it as a heuristic to enable relative motion when the cursor is hidden. Maybe that's also something that would be useful for winewayland? From a quick glance I think [this](https://gitlab.collabora.com/alf/wine/-/commit/234bec66c3248a2e3a25495361385...) from the experimental branch does a similar thing. Though I would like actual warping for visible cursors if possible (unless there are ideas to enable locked pointer/relative motion all the time and render the cursor client-side, which was mentioned in XDC 2023, but I assume there is no future plans to switch the driver to this model, and we will be sticking to heuristics), for the auto cursor placement feature of some applications. But I don't mind if we should wait for a dedicated protocol to possibly come along before continuing.
Although performing the lock/unlock dance to warp the pointer is indeed somewhat of a hack, I agree that there is enough prior-art here to make acceptable. The main caveat is that this is a best-effort approach, since the compositor is not guaranteed to honor the lock immediately. However it seems to work well enough in practice, so I am fine with this, at least until we get a proper warp protocol.
We could also feed `SetCursorPos` into our heuristics if needed, but let's see how far we can get with just warping, before we add more heuristic complexity.