1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Display exit confirmation dialog on Alt-F4

This commit is contained in:
Ivan Savenko 2023-11-12 17:35:43 +02:00
parent 59806bf112
commit 833051cced
2 changed files with 11 additions and 2 deletions

View File

@ -24,6 +24,7 @@
#include "CServerHandler.h"
#include "ClientCommandManager.h"
#include "windows/CMessage.h"
#include "windows/InfoWindows.h"
#include "render/IScreenHandler.h"
#include "render/Graphics.h"
@ -502,10 +503,14 @@ static void quitApplication()
void handleQuit(bool ask)
{
if(CSH->client && LOCPLINT && ask)
if(ask)
{
CCS->curh->set(Cursor::Map::POINTER);
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[69], quitApplication, nullptr);
if (LOCPLINT)
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[69], quitApplication, nullptr);
else
CInfoWindow::showYesNoDialog(CGI->generaltexth->allTexts[69], {}, quitApplication, {}, PlayerColor(1));
}
else
{

View File

@ -116,7 +116,11 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
if(ev.type == SDL_QUIT)
{
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
#ifdef VCMI_ANDROID
handleQuit(false);
#else
handleQuit(true);
#endif
return;
}
else if(ev.type == SDL_KEYDOWN)