From 20066a8964a069b51de24eb0fe412d8539448266 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 30 Apr 2025 11:30:06 +0200 Subject: [PATCH] Examples: DirectX12+Win32: also test for IsIconic() for sleeping since we don't seem to get a DXGI_STATUS_OCCLUDED signal when minimized. (#8603) Amend ec1d2be96f. (#2496, #3907, #6308, #7615) This technically prevents multi-viewports from working with io.ConfigViewportsNoDefaultParent=true but this is a more fringe case to handle for our example app, better tradeoff imho to use IsIconic(). --- docs/CHANGELOG.txt | 2 ++ examples/example_win32_directx12/main.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e52537692..852380a8c 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -115,6 +115,8 @@ Other changes: - Backends: Vulkan: Deep-copy ImGui_ImplVulkan_InitInfo::PipelineRenderingCreateInfo's pColorAttachmentFormats buffer when set, in order to reduce common user-error of specifying a pointer to data that gets out of scope. (#8282) +- Examples: DirectX12+Win32: also test for IsIconic() for sleeping since we don't seem to + get a DXGI_STATUS_OCCLUDED signal when minimized. (#8603) [@dooann] ----------------------------------------------------------------------- diff --git a/examples/example_win32_directx12/main.cpp b/examples/example_win32_directx12/main.cpp index 5f6cd51dd..2df2751c5 100644 --- a/examples/example_win32_directx12/main.cpp +++ b/examples/example_win32_directx12/main.cpp @@ -196,7 +196,7 @@ int main(int, char**) break; // Handle window screen locked - if (g_SwapChainOccluded && g_pSwapChain->Present(0, DXGI_PRESENT_TEST) == DXGI_STATUS_OCCLUDED) + if ((g_SwapChainOccluded && g_pSwapChain->Present(0, DXGI_PRESENT_TEST) == DXGI_STATUS_OCCLUDED) || ::IsIconic(hwnd)) { ::Sleep(10); continue;