This makes sure you can hit Ctrl-C if you don't have permission to access the raw keyboard device.
Fixes https://github.com/libsdl-org/SDL/issues/4812
(cherry picked from commit ce9e1bd32485ae8a024d8147e3aa3a36f0cb0a19)
At the point we're calling SDL_IsJoystickXboxSeriesX(), we don't know for sure that the controller is an Xbox controller.
Fixes https://github.com/libsdl-org/SDL/issues/8174
(cherry picked from commit 15bc12165ab56e6fbf93b8f3d18f2a0bb5854d8c)
Existing code is erroneous, because it adds or removes dependency's ref count based on number of InitSubSystem/QuitSubSystem calls, while ref count diff should depend on number of inited or quit dependents.
Recursive approach seems to be simplest solution that guarantees proper ref count.
Emscripten was using its own, private integer in order to allocate
new SDL_JoystickIDs. SDL keeps a similar integer for allocating
joystick-ids, one which is shared across multiple joystick backends.
SDL 2.0.13 introduces a new joystick-backend, a Virtual joystick
backend, which allows for software-driven joysticks, and which is
designed to sit alongside joystick-backends that provide access to
physical joysticks.
The Emscripten and the Virtual backends were, at times, getting
allocated the same SDL_JoystickIDs, if and when both backends were used
simultaneously. This could happen if, for example, an application
was using a virtual joystick in order to drive a touch-screen
based joystick, while also supporting physical joysticks through the
Emscripten backend.
When two joysticks end up with the same SDL_JoystickID, conflicts
can occur. For example, disconnecting a physical joystick with
the same SDL_JoystickID as a virtual one, can lead to the virtual
joystick being closed, inadvertently.
This fix makes the Emscripten backend use SDL's cross-joystick-backend
integer counter, which is shared among joystick backends, for allocating
new SDL_JoystickIDs, rather than a private, Emscripten-specific
counter.
Fixes https://github.com/libsdl-org/SDL/issues/3647
(cherry picked from commit 07cb7c10a15b95387431bcb3a1ae77cfd432707b)
(This fix was originally from @themightyoarfish on GitHub. Thanks!)
Fixes#8428.
Reference PR #8431.
(cherry picked from commit c6d9fb1ad71462bc844c6ca41e2ac7fe7cec3883)
GetRawInputDeviceList() can return a different number of devices than was allocated.
Fixes https://github.com/libsdl-org/SDL/issues/2759
(cherry picked from commit b9784feb2467dbb4cdc2474aa78098cd4f0b1630)
This reverts commit e5a15f94e2f1a8fbbffb25ea9932cda9679a68fd.
It turns out removing this check allows mice like the ROG PUGIO II to show up as game controllers. We need to find a different way to differentiate between gaming mice and pedals.
Since these mice show up as controllers, and potentially causing games to use them instead of real controllers, we'll go ahead revert this change for now.
Reopens https://github.com/libsdl-org/SDL/issues/8227
(cherry picked from commit ad0af488837e44cbea0f0eab3b2f73b50a74bff4)
If the relative protocol is unsupported, this will always be null and the destroy function won't be called.
(cherry picked from commit 0e87b71d08c75af8c4b02808038825d3b16bf854)