浏览代码

Display exit confirmation dialog on Alt-F4

Ivan Savenko 1 年之前
父节点
当前提交
833051cced
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 7 2
      client/CMT.cpp
  2. 4 0
      client/eventsSDL/InputHandler.cpp

+ 7 - 2
client/CMT.cpp

@@ -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
 	{

+ 4 - 0
client/eventsSDL/InputHandler.cpp

@@ -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)