src/video/uikit/SDL_uikitevents.m
changeset 10139 bb54e1e47110
parent 9998 f67cf37e9cd4
child 10141 fe9cf7c678f4
equal deleted inserted replaced
10138:4a8b649fee5b 10139:bb54e1e47110
    60 
    60 
    61     /* Make sure UIScrollView objects scroll properly. */
    61     /* Make sure UIScrollView objects scroll properly. */
    62     do {
    62     do {
    63         result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, seconds, TRUE);
    63         result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, seconds, TRUE);
    64     } while(result == kCFRunLoopRunHandledSource);
    64     } while(result == kCFRunLoopRunHandledSource);
       
    65 
       
    66     @autoreleasepool {
       
    67         /* Some iOS system functionality (such as Dictation on the on-screen
       
    68            keyboard) uses its own OpenGL ES context but doesn't restore the
       
    69            previous one when it's done. This is a workaround to make sure the
       
    70            expected SDL-created OpenGL ES context is active after the OS is
       
    71            finished running its own code for the frame. If this isn't done, the
       
    72            app may crash or have other nasty symptoms when Dictation is used.
       
    73          */
       
    74         EAGLContext *context = (__bridge EAGLContext *) SDL_GL_GetCurrentContext();
       
    75         if (context != NULL && [EAGLContext currentContext] != context) {
       
    76             [EAGLContext setCurrentContext:context];
       
    77         }
       
    78     }
    65 }
    79 }
    66 
    80 
    67 #endif /* SDL_VIDEO_DRIVER_UIKIT */
    81 #endif /* SDL_VIDEO_DRIVER_UIKIT */
    68 
    82 
    69 /* vi: set ts=4 sw=4 expandtab: */
    83 /* vi: set ts=4 sw=4 expandtab: */