mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 07:35:38 +00:00
(Android) Added a 'Back button/back swipe exits app' menu option
This commit is contained in:
parent
7cc8c4b6f6
commit
9cf9b942ee
|
@ -1790,6 +1790,19 @@ void GuiMenu::openOtherOptions()
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
// Whether swiping or pressing back should exit the application.
|
||||||
|
auto backEventAppExit = std::make_shared<SwitchComponent>();
|
||||||
|
backEventAppExit->setState(Settings::getInstance()->getBool("BackEventAppExit"));
|
||||||
|
s->addWithLabel("BACK BUTTON/BACK SWIPE EXITS APP", backEventAppExit);
|
||||||
|
s->addSaveFunc([backEventAppExit, s] {
|
||||||
|
if (backEventAppExit->getState() != Settings::getInstance()->getBool("BackEventAppExit")) {
|
||||||
|
Settings::getInstance()->setBool("BackEventAppExit", backEventAppExit->getState());
|
||||||
|
s->setNeedsSaving();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Settings::getInstance()->getBool("DebugFlag")) {
|
if (Settings::getInstance()->getBool("DebugFlag")) {
|
||||||
// If the --debug command line option was passed then create a dummy entry.
|
// If the --debug command line option was passed then create a dummy entry.
|
||||||
auto debugMode = std::make_shared<SwitchComponent>();
|
auto debugMode = std::make_shared<SwitchComponent>();
|
||||||
|
|
|
@ -477,8 +477,9 @@ bool InputManager::parseEvent(const SDL_Event& event)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
// Quit application if the back button is pressed.
|
// Quit application if the back button is pressed or if the back gesture is used.
|
||||||
if (event.key.keysym.sym == SDLK_AC_BACK) {
|
if (event.key.keysym.sym == SDLK_AC_BACK &&
|
||||||
|
Settings::getInstance()->getBool("BackEventAppExit")) {
|
||||||
SDL_Event quit {};
|
SDL_Event quit {};
|
||||||
quit.type = SDL_QUIT;
|
quit.type = SDL_QUIT;
|
||||||
SDL_PushEvent(&quit);
|
SDL_PushEvent(&quit);
|
||||||
|
|
|
@ -303,6 +303,9 @@ void Settings::setDefaults()
|
||||||
mBoolMap["MAMENameStripExtraInfo"] = {true, true};
|
mBoolMap["MAMENameStripExtraInfo"] = {true, true};
|
||||||
#if defined(__unix__) && !defined(__ANDROID__)
|
#if defined(__unix__) && !defined(__ANDROID__)
|
||||||
mBoolMap["DisableComposition"] = {false, false};
|
mBoolMap["DisableComposition"] = {false, false};
|
||||||
|
#endif
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
mBoolMap["BackEventAppExit"] = {true, true};
|
||||||
#endif
|
#endif
|
||||||
mBoolMap["DebugMode"] = {false, false};
|
mBoolMap["DebugMode"] = {false, false};
|
||||||
mBoolMap["DisplayGPUStatistics"] = {false, false};
|
mBoolMap["DisplayGPUStatistics"] = {false, false};
|
||||||
|
|
Loading…
Reference in a new issue