The flakiness is theoretically limited to Linux where we have to
use xvfb-run in CI. Because the tests are ran on Linux via ctest
we can more easily use CTest's built-in support for rerunning
failed tests. We have yet to actually observe this flakiness after
the other changes added in #2474 so it's possible the flakiness
has been entirely addressed.
While I was at it I de-duplicated some code for printing OpenGL
information.
Version 12 changes to URCT instead of MSVCRT which causes linker
issues with all the prebuilt MinGW binaries. This is still a liability
that will have to eventually be fixed.
There were 6 copies of InputImpl.hpp for Windows, macOS, Linux,
Linux DRM, iOS, and Android. All but Windows and Linux DRM were
identical so there's already an easy opportunity for consolidation.
The Windows header included some additional private static functions
and data. An equivalent way of expressing this is via more data and
functions instead the anonymous namespace of Win32/InputImpl.cpp so
that's what I did. To fix some issues with functions being used
before they're defined I moved number of functions into the anonymous
namespace of that file which resulted in adding `sf::` in lots of places.
InputImplUDev.hpp used by the DRM backend was trickier because includes
WindowImplDRM as a friend. This creates a weird dependency graph where a
distant class can call private functions that mutate private state. I
kept the definitions of those functions inside DRM/InputImpl.cpp while
moving their declaration to WindowImplDRM.cpp which is the only file
where they're used. This is a bit odd but it avoids using the
preprocessor and ensures that only the file that needs these functions
can call them.
In the end I was able to delete all 6 separate copies of InputImpl.hpp
and consolidate them into src/SFML/Window/InputImpl.hpp saving nearly
1,000 lines of code.
Because `sf::priv::InputImpl` is merely a set of static functions I
converted this class to a simple namespace. The use of a namespace is
what ultimately allowed me to untangle the DRM functions that were not
present in other implementations
In testing I tried passing `nullptr` to this function which caused
a segfault on Linux. If we know that's an invalid input then lets
assert against it.
sf::JoystickManager is a private type but the sf::Joystick API calls
into it so those asserts are still prone to fail due to incorrect
user input.
Yay for catching more UB :)