Fix for Game Center leaderboard screens not always responding to touch input in iOS apps that don't use SDL_iPhoneSetAnimationCallback
authorDavidLudwig <dludwig@pobox.com>
Mon, 23 Jul 2012 00:14:07 -0400
changeset 66858faee8f46165
parent 6684 992268e65626
child 6686 45014250760c
Fix for Game Center leaderboard screens not always responding to touch input in iOS apps that don't use SDL_iPhoneSetAnimationCallback
src/video/uikit/SDL_uikitevents.m
     1.1 --- a/src/video/uikit/SDL_uikitevents.m	Mon Jul 23 00:10:19 2012 -0400
     1.2 +++ b/src/video/uikit/SDL_uikitevents.m	Mon Jul 23 00:14:07 2012 -0400
     1.3 @@ -57,14 +57,24 @@
     1.4       */
     1.5      if (setjmp(*jump_env()) == 0) {
     1.6          /* if we're setting the jump, rather than jumping back */
     1.7 +		
     1.8 +		/* Let the run loop run for a short amount of time: long enough for
     1.9 +		   touch events to get processed (which is important to get certain
    1.10 +		   elements of Game Center's GKLeaderboardViewController to respond
    1.11 +		   to touch input), but not long enough to introduce a significant
    1.12 +		   delay in the rest of the app.
    1.13 +		*/
    1.14 +		const CFTimeInterval seconds = 0.000002;
    1.15 +		
    1.16 +		/* Pump most event types. */
    1.17          SInt32 result;
    1.18          do {
    1.19 -            result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE);
    1.20 +            result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, seconds, TRUE);
    1.21          } while (result == kCFRunLoopRunHandledSource);
    1.22  		
    1.23  		/* Make sure UIScrollView objects scroll properly. */
    1.24  		do {
    1.25 -			result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, 0, TRUE);
    1.26 +			result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, seconds, TRUE);
    1.27  		} while(result == kCFRunLoopRunHandledSource);
    1.28      }
    1.29  }