diff options
Diffstat (limited to 'src/video/android/SDL_androidevents.c')
-rw-r--r-- | src/video/android/SDL_androidevents.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c index 6cf9af216..5e1750421 100644 --- a/src/video/android/SDL_androidevents.c +++ b/src/video/android/SDL_androidevents.c @@ -40,27 +40,27 @@ static void ANDROIDAUDIO_PauseDevices(void) {} #endif static void -android_egl_context_restore() +android_egl_context_restore(SDL_Window *window) { SDL_Event event; - SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; - if (SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context) < 0) { + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (SDL_GL_MakeCurrent(window, (SDL_GLContext) data->egl_context) < 0) { /* The context is no longer valid, create a new one */ - data->egl_context = (EGLContext) SDL_GL_CreateContext(Android_Window); - SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context); + data->egl_context = (EGLContext) SDL_GL_CreateContext(window); + SDL_GL_MakeCurrent(window, (SDL_GLContext) data->egl_context); event.type = SDL_RENDER_DEVICE_RESET; SDL_PushEvent(&event); } } static void -android_egl_context_backup() +android_egl_context_backup(SDL_Window *window) { /* Keep a copy of the EGL Context so we can try to restore it when we resume */ - SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; data->egl_context = SDL_GL_GetCurrentContext(); /* We need to do this so the EGLSurface can be freed */ - SDL_GL_MakeCurrent(Android_Window, NULL); + SDL_GL_MakeCurrent(window, NULL); } void @@ -80,24 +80,24 @@ Android_PumpEvents(_THIS) #if SDL_ANDROID_BLOCK_ON_PAUSE if (isPaused && !isPausing) { /* Make sure this is the last thing we do before pausing */ - android_egl_context_backup(); + android_egl_context_backup(Android_Window); ANDROIDAUDIO_PauseDevices(); - if(SDL_SemWait(Android_ResumeSem) == 0) { + if (SDL_SemWait(Android_ResumeSem) == 0) { #else if (isPaused) { - if(SDL_SemTryWait(Android_ResumeSem) == 0) { + if (SDL_SemTryWait(Android_ResumeSem) == 0) { #endif isPaused = 0; ANDROIDAUDIO_ResumeDevices(); /* Restore the GL Context from here, as this operation is thread dependent */ if (!SDL_HasEvent(SDL_QUIT)) { - android_egl_context_restore(); + android_egl_context_restore(Android_Window); } } } else { #if SDL_ANDROID_BLOCK_ON_PAUSE - if( isPausing || SDL_SemTryWait(Android_PauseSem) == 0 ) { + if (isPausing || SDL_SemTryWait(Android_PauseSem) == 0) { /* We've been signaled to pause, but before we block ourselves, we need to make sure that certain key events have reached the app */ if (SDL_HasEvent(SDL_WINDOWEVENT) || SDL_HasEvent(SDL_APP_WILLENTERBACKGROUND) || SDL_HasEvent(SDL_APP_DIDENTERBACKGROUND) ) { @@ -109,8 +109,8 @@ Android_PumpEvents(_THIS) } } #else - if(SDL_SemTryWait(Android_PauseSem) == 0) { - android_egl_context_backup(); + if (SDL_SemTryWait(Android_PauseSem) == 0) { + android_egl_context_backup(Android_Window); ANDROIDAUDIO_PauseDevices(); isPaused = 1; } |