mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-16 21:48:45 +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:
@@ -34,6 +34,7 @@
|
||||
#include "../sensor/SDL_sensor_c.h"
|
||||
#endif
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
#include "../video/android/SDL_androidevents.h"
|
||||
|
||||
/* An arbitrary limit so we don't have unbounded growth */
|
||||
#define SDL_MAX_QUEUED_EVENTS 65535
|
||||
@@ -1173,18 +1174,22 @@ void SDL_FlushEvents(Uint32 minType, Uint32 maxType)
|
||||
/* Run the system dependent event loops */
|
||||
static void SDL_PumpEventsInternal(SDL_bool push_sentinel)
|
||||
{
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
|
||||
/* Free old event memory */
|
||||
SDL_FreeTemporaryMemory();
|
||||
|
||||
/* Release any keys held down from last frame */
|
||||
SDL_ReleaseAutoReleaseKeys();
|
||||
|
||||
#ifdef SDL_PLATFORM_ANDROID
|
||||
/* Android event processing is independent of the video subsystem */
|
||||
Android_PumpEvents();
|
||||
#else
|
||||
/* Get events from the video subsystem */
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
if (_this) {
|
||||
_this->PumpEvents(_this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SDL_AUDIO_DISABLED
|
||||
SDL_UpdateAudio();
|
||||
|
||||
Reference in New Issue
Block a user