diff options
author | Miodrag Milanović <mmicko@gmail.com> | 2018-08-02 08:27:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-02 08:27:04 -0700 |
commit | 114c230624c1d78fd606f09c629d351166a43574 (patch) | |
tree | 7c994b30fae9539fb51216dce6fb0a03b0f1588a | |
parent | e46209e734427d6b7ed7b05930c1e4a666de7082 (diff) | |
parent | 85e9aa34266b2b141ee9b8d635bc976c4f3b0490 (diff) | |
download | nextpnr-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
-rw-r--r-- | gui/application.cc | 13 |
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) |