We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3189

Summary: SDL_GetTouchName [Patch]
Product: SDL Reporter: Martin Gerhardy <martin.gerhardy>
Component: eventsAssignee: 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

Description Martin Gerhardy 2015-11-26 07:42:32 UTC
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.
Comment 1 Philipp Wiesemann 2015-11-26 21:10:00 UTC
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.
Comment 2 David Ludwig 2015-11-27 22:30:06 UTC
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
Comment 3 Martin Gerhardy 2015-11-28 11:07:05 UTC
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.
Comment 4 Martin Gerhardy 2015-12-28 09:08:34 UTC
*** Bug 3090 has been marked as a duplicate of this bug. ***