New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sf::Mouse::setPosition
not working with Wayland/xwayland
#2750
Comments
Doesn't seem to work in Sway (wlroots) either. |
I tested the sample code & experienced this issue within my own project, but have come to the conclusion I think it does work, but not as expected. I adjusted the sample code above to also print the mouse position every frame. When I hit any key press I do not visually see my cursor migrate on the screen, but the position reported is |
Tangentially related to this, window.setCursorGrabbed doesn't work on Sway either. It doesn't confine the mouse to the window, though nothing else is focusable, so clicks outside of the window do nothing. |
Wayland does not support getting the mouse position in desktop coordinates (although this seems to work through XWayland), and it does not support setting the mouse position in general (not even in XWayland). setMouseCursorGrabbed can be implemented with the pointer-constraints-unstable-v1 protocol (when using native Wayland instead of XWayland), the relative-pointer-unstable-v1 protocol may also be helpful. |
The inability to set the mouse position seems rather cumbersome limit to overcome for some game types, or even supporting existing game codebases that rely on this. Grabbing the cursor isn't enough for some control schemes to work correctly. |
Came across this list, that has a lot of X11 stuff which are broken in Wayland: https://gist.github.com/probonopd/9feb7c20257af5dd915e3a9f2d1f2277 Additionally, there's this repo with some potential workarounds: https://github.com/probonopd/wayland-x11-compat-protocols/ |
Prerequisite Checklist
Describe your issue here
We've received multiple reports that
sf::Mouse::setPosition()
doesn't seem to work to work when using Wayland:It might just be a bug in xwayland, but we should double check
Maybe related to #2709
Your Environment
Steps to reproduce
Expected behavior
When pressing any key, the mouse should be moved to position (200, 200)
Actual behavior
The mouse is not moved
The text was updated successfully, but these errors were encountered: