summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorRene Lindsay <rene@lunarg.com>2016-07-01 18:00:30 -0600
committerRene Lindsay <rene@lunarg.com>2016-07-01 18:00:58 -0600
commitf47577419de04adea60ce9bb6ace9dae668f88d9 (patch)
treea738b9531ecbf4b085901b3661127c6e29d5d77f /demos
parent8c07a094dc9cc4afb6b62181f341c12b9e969041 (diff)
demos: Set window minimum size on windows.
Vulkan surface must be at least 1 pixel high, to prevent crash. Change-Id: I0000000decaf15bad00000000000000000000026
Diffstat (limited to 'demos')
-rw-r--r--demos/cube.c7
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) {