-
Notifications
You must be signed in to change notification settings - Fork 62
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
cmake: print a warning if SDL version is between 2.16 and 2.20 included, ref #600 #621
Conversation
@necessarily-equal I tried that instead, but it doesn't work, I have no idea why… if (SDL2_VERSION VERSION_GREATER_EQUAL "2.16"
AND SDL2_VERSION VERSION_LESS_EQUAL "2.20")
message(WARNING "SDL is known to be buggy between version 2.16 and 2.20, see https://github.com/DaemonEngine/Daemon/issues/600")
endif() Edit: |
I mean, there is no message |
In fact |
The - find_package(SDL2 REQUIRED)
+ find_package(SDL2 REQUIRED CONFIG) |
Meh, the CI fails:
|
1e47f33
to
b72b9d3
Compare
This is how I do it, the first find_package(SDL2 QUIET CONFIG)
if(SDL2_VERSION)
if (SDL2_VERSION VERSION_GREATER_EQUAL "2.16"
AND SDL2_VERSION VERSION_LESS_EQUAL "2.20")
message(WARNING "SDL ${SDL2_VERSION} between version 2.16 and 2.20 is known to be buggy, see https://github.com/DaemonEngine/Daemon/issues/600")
endif()
else()
# CMake may be able to find SDL2 without supporting CONFIG
# If sdl2-config.cmake or SDL2Config.cmake isn't provided.
find_package(SDL2 REQUIRED)
message(WARNING "SDL version is unknown, version can't be checked for known bugs")
endif() |
I can't test, but based on the comments I'd think we could actually work around the bug. Something like
This patch filters out mouse deltas with 0 motion. It might be necessary to filter out absolute mouse position events with zero deltas too; someone would need to test that. |
That workaround would alleviate the issue quite a bit for SDL2.20 I
think, but doesn't fix it for SDL2.16 and 2.18.
…On Sun, Apr 3 2022 at 14:20:04 -0700, slipher ***@***.***> wrote:
I can't test, but based on the comments I'd think we could actually
work around the bug. Something like
diff --git a/src/engine/sys/sdl_input.cpp
b/src/engine/sys/sdl_input.cpp
index e8a29a26..48270d49 100644
--- a/src/engine/sys/sdl_input.cpp
+++ b/src/engine/sys/sdl_input.cpp
@@ -1079,7 +1079,7 @@ static void IN_ProcessEvents( bool dropInput )
{
Com_QueueEvent(
Util::make_unique<Sys::MousePosEvent>(e.motion.x, e.motion.y) );
}
- else
+ else if ( e.motion.xrel != 0
|| e.motion.yrel != 0 )
{
Com_QueueEvent(
Util::make_unique<Sys::MouseEvent>(e.motion.xrel, e.motion.yrel) );
#if defined( __linux__ ) || defined( __BSD__ )
This patch filters out mouse deltas with 0 motion. It might be
necessary to filter out absolute mouse position events with zero
deltas too; someone would need to test that.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Why not? Going on this:
|
That's after the second commit, the one that kinda fixes it. Before
(between the two related commit) there is basically no input for me.
…On Sun, Apr 3 2022 at 14:25:40 -0700, slipher ***@***.***> wrote:
Why not? Going on this:
> When in-game, when SDL_GetRelativeMouseMode()==SDL_TRUE, SDL's
> SDL_PollEvent(&e) gives, SDL_MOUSEMOTION events with both
> e.motion.xrel==0 and e.motion.yrel==0.
>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Our version of |
On my end I can delete it and build the engine, is it a fallback for some systems? It looks like CMake doesn't provide |
Right, if there is no FindSDL2.cmake in our module path or the modules shipped with CMake, the next thing is to check for the config.cmake thing. The sdl-config.cmake from the SDL repository also lacks a version number, so it doesn't help us. |
So this is cool and the CI pass, but it seems to print this on Windows, Mac and Linux:
|
Well, maybe it only checks for version on computers of lucky peoples like me… |
I don't think it should work for anyone. The |
@slipher you seem to miss something important: The file that sets a version number is On my end:
That's why I am talking about “luck”, it depends on user's own environment. My code first tries the Edit: on my end (Ubuntu 21.10 focal), the |
This, as I said above, is true. But there is a second file that does help us! So this will only give us the version number on the subset of Linux distros which ship the version config file. (The binary releases from the SDL website don't include the cmake-config stuff.) But hopefully the mouse bug only occurs on Linux so it will be OK. |
We can also raise a warning in source code when trying to compile against a broken SDL version, but given our build isn't warning free that can be missed. |
If you change the warning to only print for Linux builds then LGTM |
Do you mean the SDL issue only affects Linux systems? |
I would guess so but it doesn't matter. On Windows and Mac we provide the precompiled SDL, so no one is using an unapproved version. I don't want there to be useless warnings for every Windows or Mac build. |
Ah, I see! |
OK, now the SDL version is only checked on Linux and the message telling the version can't be checked is a |
See: