Vittorio Giovara fixed bug 1528: move hint registration from SDLUikitAppDelegate
authorSam Lantinga
Mon, 02 Jul 2012 08:37:48 -0400
changeset 6349bc8de0568373
parent 6348 049721824c2e
child 6350 19545983ac76
Vittorio Giovara fixed bug 1528: move hint registration from SDLUikitAppDelegate

When subclassing SDLUikitAppDelegate you usually override the -postFinishLaunch
method so that you can (for example) call a different function than SDL_main.

As it is now, however, overriding -postFinishLaunch will bar out the
SDL_SetHint for the idle timer. Attached a simple patch the moves the hint
callback to the -application:didiFinishLaunchingWithOptions:
src/video/uikit/SDL_uikitappdelegate.m
     1.1 --- a/src/video/uikit/SDL_uikitappdelegate.m	Mon Jul 02 08:33:10 2012 -0400
     1.2 +++ b/src/video/uikit/SDL_uikitappdelegate.m	Mon Jul 02 08:37:48 2012 -0400
     1.3 @@ -101,10 +101,6 @@
     1.4  
     1.5  - (void)postFinishLaunch
     1.6  {
     1.7 -    /* register a callback for the idletimer hint */
     1.8 -    SDL_SetHint(SDL_HINT_IDLE_TIMER_DISABLED, "0");
     1.9 -    SDL_RegisterHintChangedCb(SDL_HINT_IDLE_TIMER_DISABLED, &SDL_IdleTimerDisabledChanged);
    1.10 -
    1.11      /* run the user's application, passing argc and argv */
    1.12      SDL_iPhoneSetEventPump(SDL_TRUE);
    1.13      exit_status = SDL_main(forward_argc, forward_argv);
    1.14 @@ -121,6 +117,10 @@
    1.15      /* Set working directory to resource path */
    1.16      [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
    1.17  
    1.18 +    /* register a callback for the idletimer hint */
    1.19 +    SDL_SetHint(SDL_HINT_IDLE_TIMER_DISABLED, "0");
    1.20 +    SDL_RegisterHintChangedCb(SDL_HINT_IDLE_TIMER_DISABLED, &SDL_IdleTimerDisabledChanged);
    1.21 +
    1.22      [self performSelector:@selector(postFinishLaunch) withObject:nil afterDelay:0.0];
    1.23  
    1.24      return YES;