Added SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS to control whether SDL_hid_enumerate() enumerates all HID devices or only controllers.

By default SDL will only enumerate controllers, to reduce risk of hanging or crashing on devices with bad drivers and avoiding macOS keyboard capture permission prompts.
This commit is contained in:
Sam Lantinga 2023-05-27 09:37:38 -07:00
parent 77e59d4fa9
commit 0ffeca8a1c
10 changed files with 66 additions and 89 deletions

View file

@ -580,6 +580,17 @@ extern "C" {
*/
#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
/**
* \brief A variable to control whether SDL_hid_enumerate() enumerates all HID devices or only controllers.
*
* This variable can be set to the following values:
* "0" - SDL_hid_enumerate() will enumerate all HID devices
* "1" - SDL_hid_enumerate() will only enumerate controllers
*
* By default SDL will only enumerate controllers, to reduce risk of hanging or crashing on devices with bad drivers and avoiding macOS keyboard capture permission prompts.
*/
#define SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS "SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS"
/**
* \brief A variable containing a list of devices to ignore in SDL_hid_enumerate()
*