From da3d7f1108afed6e36ca5db86cda8c83b290df5f Mon Sep 17 00:00:00 2001 From: thrust26 Date: Fri, 1 May 2020 20:49:45 +0200 Subject: [PATCH] fix #613 (debugger focus) --- src/debugger/Debugger.cxx | 1 + src/debugger/gui/DebuggerDialog.cxx | 16 ++++++++++------ src/debugger/gui/DebuggerDialog.hxx | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index cfb16a1e5..a96f208ec 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -688,6 +688,7 @@ void Debugger::setStartState() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::setQuitState() { + myDialog->saveConfig(); saveOldState(); // Bus must be unlocked for normal operation when leaving debugger mode diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index ac3c8d6c9..fd15820c4 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -71,12 +71,11 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::loadConfig() { - // set initial focus to myPrompt - if (myFirstLoad) - { - setFocus(myPrompt); - myFirstLoad = false; - } + if(myFocusedWidget == nullptr) + // Set initial focus to prompt tab + myFocusedWidget = myPrompt; + // Restore focus + setFocus(myFocusedWidget); myTab->loadConfig(); myTiaInfo->loadConfig(); @@ -89,6 +88,11 @@ void DebuggerDialog::loadConfig() myMessageBox->setText(""); } +void DebuggerDialog::saveConfig() +{ + myFocusedWidget = _focusedWidget; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index b1b42211a..2fa007214 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -71,6 +71,7 @@ class DebuggerDialog : public Dialog ButtonWidget& unwindButton() const { return *myUnwindButton; } void showFatalMessage(const string& msg); + void saveConfig(); private: void center() override { positionAt(0); } @@ -136,7 +137,8 @@ class DebuggerDialog : public Dialog unique_ptr myLFont; // used for labels unique_ptr myNFont; // used for normal text - bool myFirstLoad{true}; + Widget* myFocusedWidget{nullptr}; + private: // Following constructors and assignment operators not supported