aboutsummaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorMiodrag Milanović <mmicko@gmail.com>2018-08-02 08:27:04 -0700
committerGitHub <noreply@github.com>2018-08-02 08:27:04 -0700
commit114c230624c1d78fd606f09c629d351166a43574 (patch)
tree7c994b30fae9539fb51216dce6fb0a03b0f1588a /gui
parente46209e734427d6b7ed7b05930c1e4a666de7082 (diff)
parent85e9aa34266b2b141ee9b8d635bc976c4f3b0490 (diff)
downloadnextpnr-114c230624c1d78fd606f09c629d351166a43574.tar.gz
nextpnr-114c230624c1d78fd606f09c629d351166a43574.tar.bz2
nextpnr-114c230624c1d78fd606f09c629d351166a43574.zip
Merge pull request #13 from YosysHQ/fix-windows-ctrl-c
Handle CTRL-C for windows build
Diffstat (limited to 'gui')
-rw-r--r--gui/application.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gui/application.cc b/gui/application.cc
index 58dc23eb..aece5d2a 100644
--- a/gui/application.cc
+++ b/gui/application.cc
@@ -27,11 +27,24 @@
NEXTPNR_NAMESPACE_BEGIN
+#ifdef _WIN32
+#include <windows.h>
+BOOL WINAPI WinHandler(DWORD dwCtrlType)
+{
+ if (dwCtrlType == CTRL_C_EVENT)
+ qApp->quit();
+ return TRUE;
+}
+#endif
+
Application::Application(int &argc, char **argv) : QApplication(argc, argv)
{
QSurfaceFormat fmt;
fmt.setSamples(10);
QSurfaceFormat::setDefaultFormat(fmt);
+#ifdef _WIN32
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)WinHandler, TRUE);
+#endif
}
bool Application::notify(QObject *receiver, QEvent *event)