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 3356

Summary: SDL_GetError returns "Unknown touch device" on first touch on OS X
Product: SDL Reporter: Elisée Maurer <eliseegw+libsdl>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.4   
Hardware: x86_64   
OS: Mac OS X 10.11   

Description Elisée Maurer 2016-06-09 14:23:48 UTC
This is a followup to https://bugzilla.libsdl.org/show_bug.cgi?id=2054

It looks like the patch in https://hg.libsdl.org/SDL/rev/7fc4a8be47a8 missed a fix in SDL_cocoawindow's touchesBeganWithEvent event handler.

That event handler calls SDL_GetNumTouchFingers (as seen here: https://hg.libsdl.org/SDL/file/b82c0f22d22a/src/video/cocoa/SDL_cocoawindow.m#l1000), which in turn calls SDL_GetTouch, triggering SDL_SetError("Unknown touch device");
Comment 1 Elisée Maurer 2016-06-14 05:00:28 UTC
After reading on other bugs, this comment in particular: https://bugzilla.libsdl.org/show_bug.cgi?id=3321#c3, I'm not 100% sure anymore if SDL error being set spuriously is viewed as a bug or not by the dev team, considering SDL_GetError() does indicate it should not be called unless an SDL function has returned an error value.

So feel free to close if appropriate.
Comment 2 Sam Lantinga 2017-08-12 02:17:25 UTC
Yes, the SDL error message is only valid if an API function returns an error.

Thanks!