From b9403da30ac3ceb5cd9111b4af5dab41215815b8 Mon Sep 17 00:00:00 2001 From: Rene Lindsay Date: Fri, 1 Jul 2016 18:00:30 -0600 Subject: demos: Set window minimum size on windows. Vulkan surface must be at least 1 pixel high, to prevent crash. Change-Id: I0000000decaf15bad00000000000000000000026 --- demos/cube.c | 7 +++++++ 1 file changed, 7 insertions(+) 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) { -- cgit v1.2.3