-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
WarpMouse & Window Decorations not working on Wayland SDL2/OpenGL ES. #8295
Comments
On Gnome based desktops, you need libdecor installed and SDL built with libdecor support for window decorations to work. Most likely, the version of SDL included in the Flatpak in the linked issue was built without libdecor support. If I build it from source against the system installed SDL, the decorations are there. Wayland doesn't support warping the mouse pointer, and it's very unlikely ever to, so for things like camera controls, you'll need to use relative mode. |
I see, how odd Flatpak would do that with base repos, I can supply a version of SDL as a dependency to solve this in the meantime I suppose.
This detail I find odd because web browsers and other applications can indeed warp the mouse on Wayland which would imply that it is indeed possible, so if my web browser can do it on Fedora Wayland, why can't SDL2? When looking into the issue I read somewhere online that mouse locking is possible in Wayland just not in the same way it would be done on Gnome, I suppose this would be due to security related reasons. Either way it should be possible for SDL2 to warp mouse on Wayland. |
It could also just be old. SDL didn't have libdecor support until late 2021, and for Wayland you generally want the newest version of SDL possible, as a lot of work was done on the Wayland backend in the last couple of years.
Applications and compatibility libraries like XWayland are able to fake it to some extent via mouse grabs and relative mode (which SDL tries to do for games that use the pointer delta + warping for camera movement), but there's no actual mechanism for warping the pointer in Wayland, so applications can't do "put the pointer at position x, y". |
You have done a great job of explaining this and for that I thank you. I did try using SDL2 mouse locking in the past but failed to do so because for some reason I was lead to believe enabling it would cause the window events X & Y variables to start reporting relative delta's as there is no reported special variable for these in the MouseButtonEvent. To get it working I had to use SDL_GetRelativeMouseState in order to access the relative mouse delta's. I believe this could be made more clear in the documentation. I have always felt like the documentation for SDL 2 was poor in-comparison to the SDL 1.2 documentation. I feel like the remarks in SDL_GetRelativeMouseState are misleading and in-specific. As such my intention in the next few days when I have time will be to create a number of pull request improvements to the documentation via; https://github.com/libsdl-org/sdlwiki Again, thank you for your understanding and response, I hope to reciprocate in the form of my pull requests to the documentation in the next few days. btw with libdecor problem atm i've just decided to make my own decor system for fun within sdl ;) |
Related Issues:
Affected project:
Details: Not sure why this is, I think it is related to creating an OpenGL ES context using SDL. Does anyone know whats going on?
The text was updated successfully, but these errors were encountered: