From 422ac626e5cb9f80b3f5f9267246f402adf460c3 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Sun, 16 Oct 2016 17:39:30 +0200 Subject: [PATCH] Updated window resize handling on (Fixes #171) --- base/vulkanexamplebase.cpp | 14 +++++++------- base/vulkanexamplebase.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index a64a1905..f19bdeb5 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -1091,19 +1091,19 @@ void VulkanExampleBase::handleMessages(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR case WM_SIZE: if ((prepared) && (wParam != SIZE_MINIMIZED)) { - destWidth = LOWORD(lParam); - destHeight = HIWORD(lParam); - if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_MINIMIZED)) + if ((resizing) || ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))) { + destWidth = LOWORD(lParam); + destHeight = HIWORD(lParam); windowResize(); } } break; + case WM_ENTERSIZEMOVE: + resizing = true; + break; case WM_EXITSIZEMOVE: - if ((prepared) && ((destWidth != width) || (destHeight != height))) - { - windowResize(); - } + resizing = false; break; } } diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index fea1ded6..c31468bc 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -68,6 +68,7 @@ private: // Destination dimensions for resizing the window uint32_t destWidth; uint32_t destHeight; + bool resizing = false; // Called if the window is resized and some resources have to be recreatesd void windowResize(); protected: