X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fd3dretrace_ws.cpp;h=42bd0abef159cd068a00d7cacbbee42050060b65;hb=1d4fd1471be8c29ed082bd6cdb3525c2b1215dc8;hp=8626a764597e49507aa9cb6e6eb2ae654720eb71;hpb=5b130ba1590e5a9853771da249360072baaf71f8;p=apitrace diff --git a/retrace/d3dretrace_ws.cpp b/retrace/d3dretrace_ws.cpp index 8626a76..42bd0ab 100644 --- a/retrace/d3dretrace_ws.cpp +++ b/retrace/d3dretrace_ws.cpp @@ -37,6 +37,13 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { MINMAXINFO *pMMI; switch (uMsg) { + case WM_KEYDOWN: + switch (wParam) { + case VK_ESCAPE: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + break; case WM_GETMINMAXINFO: // Allow to create a window bigger than the desktop pMMI = (MINMAXINFO *)lParam; @@ -45,6 +52,9 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) pMMI->ptMaxTrackSize.x = 60000; pMMI->ptMaxTrackSize.y = 60000; break; + case WM_CLOSE: + exit(0); + break; default: break; } @@ -104,7 +114,38 @@ createWindow(int width, int height) { } +void +resizeWindow(HWND hWnd, int width, int height) { + RECT rClient; + GetClientRect(hWnd, &rClient); + if (width == rClient.right - rClient.left && + height == rClient.bottom - rClient.top) { + return; + } + + RECT rWindow; + GetWindowRect(hWnd, &rWindow); + width += (rWindow.right - rWindow.left) - rClient.right; + height += (rWindow.bottom - rWindow.top) - rClient.bottom; + SetWindowPos(hWnd, NULL, rWindow.left, rWindow.top, width, height, SWP_NOMOVE); +} +bool +processEvents(void) { + MSG uMsg; + while (PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE)) { + if (uMsg.message == WM_QUIT) { + return false; + } + + if (!TranslateAccelerator(uMsg.hwnd, NULL, &uMsg)) { + TranslateMessage(&uMsg); + DispatchMessage(&uMsg); + } + } + return true; +} + } /* namespace d3dretrace */