| Summary: | SDL_GetTouchName [Patch] | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Martin Gerhardy <martin.gerhardy> |
| Component: | events | Assignee: | Ryan C. Gordon <icculus> |
| Status: | NEW --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | dll, philipp.wiesemann |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | the patch | ||
SDL_GetNumTouchFingers() and SDL_GetTouchFinger() get an SDL_TouchID as input. Maybe it would be more consistent if SDL_GetTouchName() would, too (instead of an index). Then it also could use SDL_GetTouch() internally (which already sets the error). On the other hand this could be to much indirection (and maybe overhead) if SDL_GetTouchName() is just used to list the names once. Might it make sense to rename SDL_GetTouchName to SDL_GetTouchDeviceName, to help indicate that the function gets a property specific to a touch-device, rather than an SDL_TouchID? To give some background on this proposed name-change: When I first looked at this function, I wondered if it worked on a touch-ID, given that SDL's existing touch-API functions: 1. when accepting-in an SDL_TouchID, do not have the text, 'Device', anywhere in its function name. I.e. SDL_GetNumTouchFingers, and SDL_GetTouchFinger 2. when -not- accepting-in an SDL_TouchID, and instead getting some information that's only specific to a touch-device, or the host-system in general, they -do- include the text, 'Device', in its name. I.e. SDL_GetTouchDevice, and SDL_GetNumTouchDevices For joysticks it is e.g. SDL_JoystickNameForIndex - so maybe the ForIndex should be added here, too. Also it looks like I submitted the wrong patch. There is still a const in the name member of the struct that doesn't work because I later added the strdup and free calls. Anyway - if people find this useful, I will update the patch. Even though the patch is very easy to recreate if it's really something that would be useful.. up to you guys - let me know. |
Created attachment 2313 [details] the patch Added a new function SDL_GetTouchName to SDL. currently most of the drivers don't expose a name- but that might change and imo it's still quite useful for those that do, to query the name.