diff options
| author | Rene Lindsay <rene@lunarg.com> | 2016-07-01 18:00:30 -0600 |
|---|---|---|
| committer | Rene Lindsay <rene@lunarg.com> | 2016-07-01 18:00:58 -0600 |
| commit | b9403da30ac3ceb5cd9111b4af5dab41215815b8 (patch) | |
| tree | 3cf9fb56dee50bdae52958297a3cdf00c1ae56f9 | |
| parent | eacc2e245bb9de613fc527ffa55e58b6934037ac (diff) | |
| download | usermoji-b9403da30ac3ceb5cd9111b4af5dab41215815b8.tar.xz | |
demos: Set window minimum size on windows.
Vulkan surface must be at least 1 pixel high, to prevent crash.
Change-Id: I0000000decaf15bad00000000000000000000026
| -rw-r--r-- | demos/cube.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/demos/cube.c b/demos/cube.c index f675ca5a..dbaeb352 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -299,6 +299,7 @@ struct demo { HINSTANCE connection; // hInstance - Windows Instance char name[APP_NAME_STR_LEN]; // Name to put on the window/icon HWND window; // hWnd - window handle + POINT minsize; // minimum window size #elif defined(VK_USE_PLATFORM_XLIB_KHR) | defined(VK_USE_PLATFORM_XCB_KHR) Display* display; Window xlib_window; @@ -2039,6 +2040,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { case WM_PAINT: demo_run(&demo); break; + case WM_GETMINMAXINFO: // set window's minimum size + ((MINMAXINFO*)lParam)->ptMinTrackSize = demo.minsize; + return 0; case WM_SIZE: // Resize the application to the new window size, except when // it was minimized. Vulkan doesn't support images or swapchains @@ -2099,6 +2103,9 @@ static void demo_create_window(struct demo *demo) { fflush(stdout); exit(1); } + // Window client area size must be at least 1 pixel high, to prevent crash. + demo->minsize.x = GetSystemMetrics(SM_CXMINTRACK); + demo->minsize.y = GetSystemMetrics(SM_CYMINTRACK)+1; } #elif defined(VK_USE_PLATFORM_XLIB_KHR) | defined(VK_USE_PLATFORM_XCB_KHR) static void demo_create_xlib_window(struct demo *demo) { |
