mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 22:35:59 +00:00
[Android] Fixes Bug 2041 - can't get SDL_QUIT event...
Thanks to Denis Bernard! Also, changed the Android manifest so the app doesn't quit with orientation changes, and made testgles.c exit properly on Android.
This commit is contained in:
@@ -283,9 +283,16 @@ void Java_org_libsdl_app_SDLActivity_nativeLowMemory(
|
||||
void Java_org_libsdl_app_SDLActivity_nativeQuit(
|
||||
JNIEnv* env, jclass cls)
|
||||
{
|
||||
/* Discard previous events. The user should have handled state storage
|
||||
* in SDL_APP_WILLENTERBACKGROUND. After nativeQuit() is called, no
|
||||
* events other than SDL_QUIT and SDL_APP_TERMINATING should fire */
|
||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||
/* Inject a SDL_QUIT event */
|
||||
SDL_SendQuit();
|
||||
SDL_SendAppEvent(SDL_APP_TERMINATING);
|
||||
/* Resume the event loop so that the app can catch SDL_QUIT which
|
||||
* should now be the top event in the event queue. */
|
||||
if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
|
||||
}
|
||||
|
||||
/* Pause */
|
||||
|
Reference in New Issue
Block a user