fixed the quit bug in issue #850

This commit is contained in:
Thomas Jentzsch 2021-12-03 17:28:48 +01:00
parent 10bde004ed
commit 72dd4b3ebb
6 changed files with 32 additions and 0 deletions

View File

@ -1558,6 +1558,8 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
saveJoyMapping(); saveJoyMapping();
if (myState != EventHandlerState::LAUNCHER) if (myState != EventHandlerState::LAUNCHER)
exitEmulation(); exitEmulation();
else
exitLauncher();
myOSystem.quit(); myOSystem.quit();
} }
return; return;
@ -2715,6 +2717,12 @@ void EventHandler::setState(EventHandlerState state)
myEvent.clear(); myEvent.clear();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::exitLauncher()
{
myOSystem.launcher().quit();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::exitEmulation(bool checkLauncher) void EventHandler::exitEmulation(bool checkLauncher)
{ {

View File

@ -367,6 +367,7 @@ class EventHandler
void saveKeyMapping(); void saveKeyMapping();
void saveJoyMapping(); void saveJoyMapping();
void exitLauncher();
void exitEmulation(bool checkLauncher = false); void exitEmulation(bool checkLauncher = false);
protected: protected:

View File

@ -84,6 +84,12 @@ void Launcher::reload()
(static_cast<LauncherDialog*>(myBaseDialog))->reload(); (static_cast<LauncherDialog*>(myBaseDialog))->reload();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Launcher::quit()
{
(static_cast<LauncherDialog*>(myBaseDialog))->quit();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dialog* Launcher::baseDialog() Dialog* Launcher::baseDialog()
{ {

View File

@ -65,6 +65,11 @@ class Launcher : public DialogContainer
*/ */
void reload(); void reload();
/**
Wrapper for LauncherDialog::quit() method.
*/
void quit();
/** /**
Return (and possibly create) the bottom-most dialog of this container. Return (and possibly create) the bottom-most dialog of this container.
*/ */

View File

@ -431,6 +431,12 @@ void LauncherDialog::reload()
myPendingReload = false; myPendingReload = false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::quit()
{
saveConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::tick() void LauncherDialog::tick()
{ {

View File

@ -96,6 +96,12 @@ class LauncherDialog : public Dialog
*/ */
void reload(); void reload();
/**
Quit the dialog
*/
void quit();
void tick() override; void tick() override;
private: private: