These report their VID/PID as a Nintendo Switch Pro controller, but they are actually left/right Joy-Cons. We'll fix up the joystick GUID so applications can handle them appropriately.
This reverts commit ff233fe306.
This doesn't compile cleanly with Visual Studio and I don't want to introduce any subtle issues because we're passing the wrong types of pointers to WGI functions.
This makes the joystick locking more robust by holding the lock while updating joysticks.
The lock should be held when calling any SDL joystick function on a different thread than the one calling SDL_PumpEvents() and SDL_JoystickUpdate().
It is now possible to hold the lock while reinitializing the joystick subsystem, however any open joysticks will become invalid and potentially cause crashes if used afterwards.
Fixes https://github.com/libsdl-org/SDL/issues/6063
In order to inhibit the screen saver, SDL currently uses
`org.freedesktop.ScreenSaver.Inhibit()` and, as a fallback, a protocol
specific method for X11 or Wayland.
Accessing `org.freedesktop.ScreenSaver` is usually not allowed when
inside a sandbox like Flatpak, unless the permission has been explicitly
granted to the application.
Another issue is that the Wayland protocol "Idle inhibit" is relatively
new and not yet widely adopted. For example Mutter still doesn't support
it.
For those reasons, when running under Flatpak or Snap, we should try to
inhibit the screen saver by using xdg-desktop-portal instead. This
should give us an higher chance of success.
Fixes: https://github.com/libsdl-org/SDL/issues/6075
Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
Refactor the previous sandbox check in a standalone function that also
includes Snap support.
Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
SDL_DBus_CallWithBasicReply() allows us to send a DBus message and get
its result, if it is a basic type, e.g. integer or string.
With this function we avoid duplicating code.
Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
This is in the hope that revving the product version doesn't change the mapping, which is the case for some devices. In cases where it does, we just need to provide a mapping for each version of the product.
Adjust candidate count so list is not draw bigger that needed. This also fix potential uninitialised read of variable `candsize[i]` if `vertical` is false.
This is now used as a crc field in the mapping rather than directly in mapping guids, for better mapping compatibility between versions of SDL.
Added SDL_GetJoystickGUIDInfo() to get device information encoded in a joystick GUID, so that mapping programs can clear the CRC from the GUID when generating mappings.
sort_controllers.py has been updated to extract the CRC from mappings created by older mapping programs and convert it into the new crc field. It will also take the CRC into account when checking for duplicate mappings.
Also regenerated the GUIDs for the PS2/PSP/Vita controller mappings, fixing https://github.com/libsdl-org/SDL/issues/6151
find_lib() uses sort -V, which is a GNU extension. Users of non-GNU
operating systems should either install GNU coreutils (assumed to
provide a gsort executable), or use the CMake build system.
Resolves: https://github.com/libsdl-org/SDL/issues/6106
Signed-off-by: Simon McVittie <smcv@collabora.com>