|
@@ -26,6 +26,7 @@
|
|
|
#include "SDL_events.h"
|
|
|
#include "SDL_androidkeyboard.h"
|
|
|
#include "SDL_androidwindow.h"
|
|
|
+#include "../SDL_sysvideo.h"
|
|
|
|
|
|
/* Can't include sysaudio "../../audio/android/SDL_androidaudio.h"
|
|
|
* because of THIS redefinition */
|
|
@@ -95,11 +96,14 @@ Android_PumpEvents_Blocking(_THIS)
|
|
|
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
|
|
|
|
|
|
if (videodata->isPaused) {
|
|
|
+ SDL_bool isContextExternal = SDL_IsVideoContextExternal();
|
|
|
|
|
|
/* Make sure this is the last thing we do before pausing */
|
|
|
- SDL_LockMutex(Android_ActivityMutex);
|
|
|
- android_egl_context_backup(Android_Window);
|
|
|
- SDL_UnlockMutex(Android_ActivityMutex);
|
|
|
+ if (!isContextExternal) {
|
|
|
+ SDL_LockMutex(Android_ActivityMutex);
|
|
|
+ android_egl_context_backup(Android_Window);
|
|
|
+ SDL_UnlockMutex(Android_ActivityMutex);
|
|
|
+ }
|
|
|
|
|
|
ANDROIDAUDIO_PauseDevices();
|
|
|
openslES_PauseDevices();
|
|
@@ -112,7 +116,7 @@ Android_PumpEvents_Blocking(_THIS)
|
|
|
openslES_ResumeDevices();
|
|
|
|
|
|
/* Restore the GL Context from here, as this operation is thread dependent */
|
|
|
- if (!SDL_HasEvent(SDL_QUIT)) {
|
|
|
+ if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) {
|
|
|
SDL_LockMutex(Android_ActivityMutex);
|
|
|
android_egl_context_restore(Android_Window);
|
|
|
SDL_UnlockMutex(Android_ActivityMutex);
|
|
@@ -146,11 +150,14 @@ Android_PumpEvents_NonBlocking(_THIS)
|
|
|
|
|
|
if (videodata->isPaused) {
|
|
|
|
|
|
+ SDL_bool isContextExternal = SDL_IsVideoContextExternal();
|
|
|
if (backup_context) {
|
|
|
|
|
|
- SDL_LockMutex(Android_ActivityMutex);
|
|
|
- android_egl_context_backup(Android_Window);
|
|
|
- SDL_UnlockMutex(Android_ActivityMutex);
|
|
|
+ if (!isContextExternal) {
|
|
|
+ SDL_LockMutex(Android_ActivityMutex);
|
|
|
+ android_egl_context_backup(Android_Window);
|
|
|
+ SDL_UnlockMutex(Android_ActivityMutex);
|
|
|
+ }
|
|
|
|
|
|
ANDROIDAUDIO_PauseDevices();
|
|
|
openslES_PauseDevices();
|
|
@@ -167,7 +174,7 @@ Android_PumpEvents_NonBlocking(_THIS)
|
|
|
openslES_ResumeDevices();
|
|
|
|
|
|
/* Restore the GL Context from here, as this operation is thread dependent */
|
|
|
- if (!SDL_HasEvent(SDL_QUIT)) {
|
|
|
+ if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) {
|
|
|
SDL_LockMutex(Android_ActivityMutex);
|
|
|
android_egl_context_restore(Android_Window);
|
|
|
SDL_UnlockMutex(Android_ActivityMutex);
|