X-Git-Url: http://pileus.org/git/?p=wmpus;a=blobdiff_plain;f=sys-win32.c;h=0e52935832df55bde60cefb551af5fa93210e4c7;hp=afacdd2ba99ec8d3b3ab83b923d1462a5e5d44fc;hb=52b06a9790e02381d11d9811c331ebf1121a2396;hpb=abf32f3ab4e5214d1a64579d4c7d8134ab46d797 diff --git a/sys-win32.c b/sys-win32.c index afacdd2..0e52935 100644 --- a/sys-win32.c +++ b/sys-win32.c @@ -305,6 +305,12 @@ BOOL CALLBACK LoopProc(HWND hwnd, LPARAM user) return TRUE; } +BOOL WINAPI CtrlProc(DWORD type) +{ + sys_exit(); + return TRUE; +} + /******************** * System functions * ********************/ @@ -429,6 +435,9 @@ win_t *sys_init(void) //if (!RegisterHotKey(NULL, 123, MOD_CONTROL, VK_LBUTTON)) // printf("sys_init: Error Registering Hotkey - %lu\n", GetLastError()); + /* Capture ctrl-c and console widnow close */ + SetConsoleCtrlHandler(CtrlProc, TRUE); + return root = win_new(hwnd,0); } @@ -446,7 +455,7 @@ void sys_run(win_t *root) void sys_exit(void) { - PostQuitMessage(0); + PostMessage(root->sys->hwnd, WM_QUIT, 0, 0); } void sys_free(win_t *root)