mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-25 02:48:50 +02:00
Android life cycle behavior more closely matches iOS
This change also decouples the pause/resume handling from the video subsystem on Android, so applications that don't use SDL for video can get application life cycle events. The semantics for the life cycle events are that they need to be handled in an event watch callback, and once they've been delivered, the application will block until it's been resumed. SDL_HINT_ANDROID_BLOCK_ON_PAUSE can be used to control that behavior, and if that's set to "0", then the application will continue to run in the background at low CPU usage until being resumed or stopped. SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO has been removed, and the audio will be paused when the application is paused. Fixes https://github.com/libsdl-org/SDL/issues/3193
This commit is contained in:
@@ -48,11 +48,11 @@ SDL_GLContext Android_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *win
|
||||
{
|
||||
SDL_GLContext ret;
|
||||
|
||||
Android_ActivityMutex_Lock_Running();
|
||||
Android_LockActivityMutexOnceRunning();
|
||||
|
||||
ret = SDL_EGL_CreateContext(_this, window->internal->egl_surface);
|
||||
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
Android_UnlockActivityMutex();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ int Android_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
int retval;
|
||||
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
Android_LockActivityMutex();
|
||||
|
||||
/* The following two calls existed in the original Java code
|
||||
* If you happen to have a device that's affected by their removal,
|
||||
@@ -72,7 +72,7 @@ int Android_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
_this->egl_data->eglWaitGL();*/
|
||||
retval = SDL_EGL_SwapBuffers(_this, window->internal->egl_surface);
|
||||
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
Android_UnlockActivityMutex();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user