Made HIDAPI device change notifications available via SDL_hid_device_change_count()

This commit is contained in:
Sam Lantinga
2021-11-11 12:45:38 -08:00
parent 77a1ad1c61
commit c9ada1c142
5 changed files with 547 additions and 473 deletions
+29
View File
@@ -122,9 +122,13 @@ typedef struct SDL_hid_device_info
* be called at the beginning of execution however, if there is a chance of
* HIDAPI handles being opened by different threads simultaneously.
*
* Each call to this function should have a matching call to SDL_hid_exit()
*
* \returns 0 on success and -1 on error.
*
* \since This function is available since SDL 2.0.18.
*
* \sa SDL_hid_exit
*/
extern DECLSPEC int SDLCALL SDL_hid_init(void);
@@ -137,9 +141,32 @@ extern DECLSPEC int SDLCALL SDL_hid_init(void);
* \returns 0 on success and -1 on error.
*
* \since This function is available since SDL 2.0.18.
*
* \sa SDL_hid_init
*/
extern DECLSPEC int SDLCALL SDL_hid_exit(void);
/**
* Check to see if devices may have been added or removed.
*
* Enumerating the HID devices is an expensive operation, so you can call this
* to see if there have been any system device changes since the last call to
* this function. A change in the counter returned doesn't necessarily mean
* that anything has changed, but you can call SDL_hid_enumerate() to get an
* updated device list.
*
* Calling this function for the first time may cause a thread or other
* system resource to be allocated to track device change notifications.
*
* \returns a change counter that is incremented with each potential device
* change, or 0 if device change detection isn't available.
*
* \since This function is available since SDL 2.0.18.
*
* \sa SDL_hid_enumerate
*/
extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
/**
* Enumerate the HID Devices.
*
@@ -157,6 +184,8 @@ extern DECLSPEC int SDLCALL SDL_hid_exit(void);
* SDL_hid_free_enumeration().
*
* \since This function is available since SDL 2.0.18.
*
* \sa SDL_hid_device_change_count
*/
extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
+1
View File
@@ -846,3 +846,4 @@
#define SDL_GetWindowMouseRect SDL_GetWindowMouseRect_REAL
#define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_REAL
#define SDL_RenderLogicalToWindow SDL_RenderLogicalToWindow_REAL
#define SDL_hid_device_change_count SDL_hid_device_change_count_REAL
+1
View File
@@ -915,3 +915,4 @@ SDL_DYNAPI_PROC(int,SDL_SetWindowMouseRect,(SDL_Window *a, const SDL_Rect *b),(a
SDL_DYNAPI_PROC(const SDL_Rect*,SDL_GetWindowMouseRect,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_RenderWindowToLogical,(SDL_Renderer *a, int b, int c, float *d, float *e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(void,SDL_RenderLogicalToWindow,(SDL_Renderer *a, float b, float c, int *d, int *e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(Uint32,SDL_hid_device_change_count,(void),(),return)
+512 -8
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff