From 72dd4b3ebbb210869f64b552496adf081bb236cf Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Fri, 3 Dec 2021 17:28:48 +0100 Subject: [PATCH] fixed the quit bug in issue #850 --- src/emucore/EventHandler.cxx | 8 ++++++++ src/emucore/EventHandler.hxx | 1 + src/gui/Launcher.cxx | 6 ++++++ src/gui/Launcher.hxx | 5 +++++ src/gui/LauncherDialog.cxx | 6 ++++++ src/gui/LauncherDialog.hxx | 6 ++++++ 6 files changed, 32 insertions(+) diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 8232a4b50..d5708cad5 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -1558,6 +1558,8 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) saveJoyMapping(); if (myState != EventHandlerState::LAUNCHER) exitEmulation(); + else + exitLauncher(); myOSystem.quit(); } return; @@ -2715,6 +2717,12 @@ void EventHandler::setState(EventHandlerState state) myEvent.clear(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void EventHandler::exitLauncher() +{ + myOSystem.launcher().quit(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::exitEmulation(bool checkLauncher) { diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index aac604590..3607a3358 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -367,6 +367,7 @@ class EventHandler void saveKeyMapping(); void saveJoyMapping(); + void exitLauncher(); void exitEmulation(bool checkLauncher = false); protected: diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx index befb08d72..7b630e685 100644 --- a/src/gui/Launcher.cxx +++ b/src/gui/Launcher.cxx @@ -84,6 +84,12 @@ void Launcher::reload() (static_cast(myBaseDialog))->reload(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Launcher::quit() +{ + (static_cast(myBaseDialog))->quit(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Dialog* Launcher::baseDialog() { diff --git a/src/gui/Launcher.hxx b/src/gui/Launcher.hxx index 4af995ae6..207f0a319 100644 --- a/src/gui/Launcher.hxx +++ b/src/gui/Launcher.hxx @@ -65,6 +65,11 @@ class Launcher : public DialogContainer */ void reload(); + /** + Wrapper for LauncherDialog::quit() method. + */ + void quit(); + /** Return (and possibly create) the bottom-most dialog of this container. */ diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index ec9b28371..7a4c937b1 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -431,6 +431,12 @@ void LauncherDialog::reload() myPendingReload = false; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void LauncherDialog::quit() +{ + saveConfig(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::tick() { diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index 135171f3f..20f1768bc 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -96,6 +96,12 @@ class LauncherDialog : public Dialog */ void reload(); + /** + Quit the dialog + */ + void quit(); + + void tick() override; private: