1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Moved shutdown request dialog handling to GameInstance

This commit is contained in:
Ivan Savenko
2025-03-03 21:45:58 +00:00
parent f8c1d217d4
commit 9732d39c70
10 changed files with 44 additions and 82 deletions

View File

@@ -19,6 +19,7 @@
#include "InputSourceGameController.h"
#include "../GameEngine.h"
#include "../GameEngineUser.h"
#include "../gui/CursorHandler.h"
#include "../gui/EventDispatcher.h"
#include "../gui/MouseButton.h"
@@ -194,9 +195,9 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
{
std::scoped_lock interfaceLock(ENGINE->interfaceMutex);
#ifdef VCMI_ANDROID
handleQuit(false);
ENGINE->user().onShutdownRequested(false);
#else
handleQuit(true);
ENGINE->user().onShutdownRequested(true);
#endif
return;
}
@@ -206,14 +207,14 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
{
// FIXME: dead code? Looks like intercepted by OS/SDL and delivered as SDL_Quit instead?
std::scoped_lock interfaceLock(ENGINE->interfaceMutex);
handleQuit(true);
ENGINE->user().onShutdownRequested(true);
return;
}
if(ev.key.keysym.scancode == SDL_SCANCODE_AC_BACK && !settings["input"]["handleBackRightMouseButton"].Bool())
{
std::scoped_lock interfaceLock(ENGINE->interfaceMutex);
handleQuit(true);
ENGINE->user().onShutdownRequested(true);
return;
}
}