From a266cd2f70e17c158ac9a8fa4b0783692a95b189 Mon Sep 17 00:00:00 2001 From: furo Date: Wed, 18 Sep 2024 12:10:25 +0200 Subject: [PATCH] Save the config file when the app is minimized on Android --- src/engine/client/input.cpp | 4 ++++ src/engine/client/input.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index f94894eca..f590ba8c0 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -80,6 +80,7 @@ void CInput::Init() m_pGraphics = Kernel()->RequestInterface(); m_pConsole = Kernel()->RequestInterface(); + m_pConfigManager = Kernel()->RequestInterface(); MouseModeRelative(); @@ -824,6 +825,9 @@ int CInput::Update() } break; case SDL_WINDOWEVENT_MINIMIZED: +#if defined(CONF_PLATFORM_ANDROID) // Save the config when minimized on Android. + m_pConfigManager->Save(); +#endif Graphics()->WindowDestroyNtf(Event.window.windowID); break; diff --git a/src/engine/client/input.h b/src/engine/client/input.h index 70127785f..d0098abf1 100644 --- a/src/engine/client/input.h +++ b/src/engine/client/input.h @@ -14,6 +14,7 @@ #include class IEngineGraphics; +class IConfigManager; class CInput : public IEngineInput { @@ -59,6 +60,7 @@ public: private: IEngineGraphics *m_pGraphics; IConsole *m_pConsole; + IConfigManager *m_pConfigManager; IEngineGraphics *Graphics() const { return m_pGraphics; } IConsole *Console() const { return m_pConsole; }