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 3802

Summary: Add TimerID as parameter to SDL_TimerCallback(...) callback function
Product: SDL Reporter: george.oros
Component: timerAssignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: linus.probert
Version: HG 2.1   
Hardware: All   
OS: All   
Attachments: Solves the issue. But there might be stuff I'm not seeing

Description george.oros 2017-09-06 13:29:06 UTC
Would be nice to get the TimerID as a parameter to the timer callback function.
Comment 1 Sam Lantinga 2017-09-06 17:32:21 UTC
I agree, added for consideration for SDL 2.1.
Comment 2 Linus Probert 2018-10-15 21:07:17 UTC
I was having a look at the SDL code and made a quick implementation of this issue just to get some practice navigating the code and... well I like to code. :D

Anywho, is this issue still relevant? Would you like to see my patch or is there already a solution in the pipe?

I haven't spent much time browsing through the documentation and stuff, but if you want my patch but want me to read through some code of conduct or format guides or whatever then please point me in the right direction.

Br,
Linus
Comment 3 george.oros 2018-10-16 16:43:16 UTC
@linus.probert@gmail.com
Sure I would like to see the patch/fix.
Comment 4 Linus Probert 2018-10-16 18:43:53 UTC
Created attachment 3376 [details]
Solves the issue. But there might be stuff I'm not seeing

Attaching a patch. Perhaps (likely) there is a ton of things that I should have thought of but didn't. Just get back to me with all of it and I will try to adapt.

I use SDL _alot_ so it would be wonderful to get into the source of it a bit more.
Comment 5 george.oros 2018-10-17 07:49:37 UTC
I haven't tested with this patch, but the fix should solve this bug. Thank you!
Comment 6 Linus Probert 2018-10-17 09:24:40 UTC
It worked in the testbed I set up at least. My concern is how "true" you decide to be to backwards compatibility. It will require code changes for those who decide to upgrade. But perhaps that is acceptable for a minor version upgrade?
Comment 7 george.oros 2018-10-17 16:05:27 UTC
I reported this "bug" (more of a missing feature) as I needed this fix. Of course it will break backward compatibility but this is something you have to decide if it is acceptable in the given context.
I assume nobody else complained about this point until now and the code is pretty old; on the other hand the fix is trivial.
Comment 8 Sam Lantinga 2018-11-03 00:27:45 UTC
This is a good idea, and we should probably accept this patch for SDL 2.1, where we can change the ABI.