Closed codecnotsupported closed 4 days ago
Doesn't it need SDL_ShowCursor(SDL_ENABLE);
afterwards?
Doesn't it need
SDL_ShowCursor(SDL_ENABLE);
afterwards?
For some reason it doesn't work when I put SDL_ShowCursor(SDL_ENABLE);
afterwards.
Also the cursor somehow correctly shows up afterwards. Tested it on X11/Wayland.
Looks OK but will require testing on non-wayland since the "somehow shows up despite no enable" sounds suspicious. Alternatively the line could be put under some sort of "if wayland".
Somewhat relatedly, most uses for warping would be obsoleted by #654.
Looks OK but will require testing on non-wayland since the "somehow shows up despite no enable" sounds suspicious.
Suspicious would be putting it lightly, I've many questions after investigating the relevant SDL2 function. But I am willing to say this is a good enough workaround.
Somewhat relatedly, most uses for warping would be obsoleted by #654.
Alternatively the line could be put under some sort of "if wayland".
My first thought was.
const char *windowBackend = SDL_GetCurrentVideoDriver();
if (strcmp(windowBackend, "wayland") == 0) {
SDL_ShowCursor(SDL_DISABLE); // needed for SDL2+Wayland where warping isn't allowed otherwise
}
But since it works fine on both Wayland & X11 a simple #if __unix__
would suffice.
We can take it. We have a testing pass. So we'll try and get our Linux testers on it.
SDL2 does not support warping on Wayland if the Cursor is visible.
https://github.com/libsdl-org/SDL/blob/efaa58732abb3faf3900b2d93a166b955fbd8ed0/src/video/wayland/SDL_waylandmouse.c#L646
This fixes: https://github.com/ZeroK-RTS/Zero-K/issues/5005 I tested it, verified it works, please check if this breaks other platforms.