1
0
mirror of https://github.com/YosysHQ/nextpnr.git synced 2026-02-26 08:53:46 +00:00

Handle CTRL-C for windows build

This commit is contained in:
Miodrag Milanovic
2018-08-02 09:54:16 +02:00
parent 62e61c44e8
commit 85e9aa3426

View File

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