-
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
SDL_GetGlobalMouseState reports weird coordinates (Linux, Xwayland) #5174
Comments
Both GetWindowPosition and global mouse state are unsupported in native Wayland, and should return -1 indicating this. This isn't the end of the world though, if I remember correctly their code already has a path to use the non-global GetMouseState while tracking the mouse enter/leave events. Xwayland may be a different story but I would check native Wayland first, since that will be the priority in the near future anyhow. |
|
Oh, right, I was thinking of Set rather than Get. I think Get falls back to the window-relative version, so you can only detect it with something else like GetWindowPosition. |
In dhewm3 I use |
On the native Wayland side I've been doing a bunch of work that makes the coordinates relatively sane for single-display setups - past that, global queries still can't be used (and multi-window is still a stretch if you try to write your own focus detection for some reason). UE5 has been my test for the recent commits and I have to say, having a feature query for global window/mouse position does seem like a really good idea since the alternative is basically to hardcode checks for SDL_GetCurrentVideoDriver, which is a terrible idea and only a lazy person would do that. |
Is this still an issue? XWayland and the SDL Wayland backend have had a lot of work done on them over the past two years, I can't replicate the original issue on the current version XWayland, and the SDL Wayland backend manages to fake the global mouse coordinates well enough for the 99.9% of applications that just query them to manually transform the global pointer coordinates to relative (like the UE5 editor). |
I think this is fixed, please let us know if that's not the case. |
I hope this isn't me just not understanding some of the concepts - but I received weird values for the global mouse state
the window (0:0) the mouse is hovering is on SDL display 0 (0:0:2560:1440), but the global mouse position is at 3646:769 - this looks like a bug in SDL for me. I will report it there. Weird thing is that the SDL display 1 has a x position of 2560 but is the left display. Not sure how to convert the mouse coordinates properly.
When I create the window on the other display, I also get invalid(?) values:
display 1 is reported as x-offset 2560 - the global mouse coordinate was e.g. 956 while hovering the window at 2560:0 (fullscreen)
the imgui issue for reference: ocornut/imgui#2117 (comment)
The text was updated successfully, but these errors were encountered: