From c0b6e43c302b7d95059bed4e41d6a50741c9ec0d Mon Sep 17 00:00:00 2001 From: Piers Daniell Date: Thu, 18 Feb 2016 10:54:15 -0700 Subject: Don't use width=0,height=0 on window minimize Vulkan doesn't support width=0 and height=0 so we just ignore the minimize request on Windows. --- demos/cube.c | 11 ++++++++--- demos/tri.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/demos/cube.c b/demos/cube.c index 9b84cccf..fb21a07b 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -1923,9 +1923,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { demo_run(&demo); break; case WM_SIZE: - demo.width = lParam & 0xffff; - demo.height = lParam & 0xffff0000 >> 16; - demo_resize(&demo); + // Resize the application to the new window size, except when + // it was minimized. Vulkan doesn't support images or swapchains + // with width=0 and height=0. + if (wParam != SIZE_MINIMIZED) { + demo.width = lParam & 0xffff; + demo.height = lParam & 0xffff0000 >> 16; + demo_resize(&demo); + } break; default: break; diff --git a/demos/tri.c b/demos/tri.c index 03378a8b..e059acb5 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -1522,9 +1522,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { break; } case WM_SIZE: - demo.width = lParam & 0xffff; - demo.height = lParam & 0xffff0000 >> 16; - demo_resize(&demo); + // Resize the application to the new window size, except when + // it was minimized. Vulkan doesn't support images or swapchains + // with width=0 and height=0. + if (wParam != SIZE_MINIMIZED) { + demo.width = lParam & 0xffff; + demo.height = lParam & 0xffff0000 >> 16; + demo_resize(&demo); + } break; default: break; -- cgit v1.2.3