Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Made the application activity events consistent between iOS and Android
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 8, 2012
1 parent 9dda9df commit 1d9ab06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/android/SDL_android.cpp
Expand Up @@ -39,7 +39,7 @@ extern "C" {
#define LOGE(...) do {} while (false)


/* Impelemented in audio/android/SDL_androidaudio.c */
/* Implemented in audio/android/SDL_androidaudio.c */
extern void Android_RunAudioThread();
} // C

Expand Down Expand Up @@ -172,8 +172,8 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativePause(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
}
}

Expand All @@ -182,8 +182,8 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/video/uikit/SDL_uikitappdelegate.m
Expand Up @@ -140,6 +140,7 @@ - (void) applicationWillResignActive:(UIApplication*)application

SDL_Window *window;
for (window = _this->windows; window != nil; window = window->next) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
}
}
Expand All @@ -156,6 +157,7 @@ - (void) applicationDidBecomeActive:(UIApplication*)application

SDL_Window *window;
for (window = _this->windows; window != nil; window = window->next) {
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}
Expand Down

0 comments on commit 1d9ab06

Please sign in to comment.