Quitting when Android asks to do so to recover resources, previously a phone with Tux Paint running unatended in the background and asked to quit by Android, greated the user with an "Are you sure" sound but the user was unable to interact with Tux Paint anymore.
This commit is contained in:
parent
51fefa32ac
commit
1cfde8e518
1 changed files with 11 additions and 0 deletions
|
|
@ -359,6 +359,7 @@ extern status_t haiku_trash(const char *f);
|
|||
#define AUTOSAVE_GOING_BACKGROUND
|
||||
#include "android_print.h"
|
||||
#include "android_assets.h"
|
||||
int entered_background = 0;
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -2739,6 +2740,7 @@ static void mainloop(void)
|
|||
{
|
||||
do_save(cur_tool, 0, 1);
|
||||
save_current();
|
||||
entered_background = 1;
|
||||
}
|
||||
}
|
||||
else if (event.type == SDL_APP_DIDENTERFOREGROUND)
|
||||
|
|
@ -2754,6 +2756,7 @@ static void mainloop(void)
|
|||
free(fname);
|
||||
}
|
||||
redraw_tux_text();
|
||||
entered_background = 0;
|
||||
}
|
||||
#endif
|
||||
else if (event.type == SDL_WINDOWEVENT)
|
||||
|
|
@ -14813,6 +14816,14 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef AUTOSAVE_GOING_BACKGROUND
|
||||
/* If we are already in background, and Android wants to recover resources, it will call for quitting.
|
||||
However, Android will not allow user interaction anymore.
|
||||
Since the drawing is already (auto)saved, it is safe to quit here */
|
||||
if (entered_background)
|
||||
cleanup();
|
||||
#endif
|
||||
|
||||
val_x = val_y = motioner = 0;
|
||||
valhat_x = valhat_y = hatmotioner = 0;
|
||||
emulate_button_pressed = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue