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 1221

Summary: Patch that adds hint to disable the idle timeout on iOS
Product: SDL Reporter: Tim Angus <tim>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: icculus
Version: HG 2.0   
Hardware: iPhone/iPod touch   
OS: iOS (All)   
Attachments: Patch that adds hint to disable the idle timeout on iOS
Patch that adds hint to disable the idle timeout on iOS
Alternative patch that just adds the missing file

Description Tim Angus 2011-06-10 06:34:30 UTC
Created attachment 621 [details]
Patch that adds hint to disable the idle timeout on iOS

iOS will timeout after about 45 seconds with no input and dim the screen, then subsequently lock the phone. This is fine for applications that always have touch input, but games often use the accelerometer alone. Accelerometer inputs are not counted towards preventing the idle timeout, so if this is the primary means of control, the idle timer must be disabled.

This patch adds a hint SDL_IOS_IDLE_TIMER_DISABLED in order to do this. I found I needed to add a callback facility to the hint system in order to notify any interested parties when a particular hint value changed. This was necessary as there isn't really a convenient place to periodically check the hint value on the iOS port of SDL and only checking the hint once on start up means you can't toggle the setting later on. It's probably quite a useful addition for future hints though, so I don't feel too bad about it.
Comment 1 Ryan C. Gordon 2011-06-13 10:24:44 UTC
This is now hg changeset 3ecad5e5dbe4, thanks!

--ryan.
Comment 2 Ryan C. Gordon 2011-06-14 11:28:01 UTC
Whoops, this patch didn't include SDL_hints_c.h ... can you add that file to this bug report so I can fix the build?

--ryan.
Comment 3 Tim Angus 2011-06-15 02:26:26 UTC
Created attachment 626 [details]
Patch that adds hint to disable the idle timeout on iOS

New patch, now including SDL_hints_c.h. I've got so used to Xcode's svn integration (which auto adds new files to source control) that I completely forgot about the new files. Apologies again.
Comment 4 Tim Angus 2011-06-15 02:29:18 UTC
Created attachment 627 [details]
Alternative patch that just adds the missing file

And here is a patch that just adds the file I missed, without the rest of the changes.
Comment 5 Ryan C. Gordon 2011-06-15 09:53:02 UTC
Thanks, this is in the repo now!

--ryan.