Backends: Win32: made it so that an appearing viewport showing up doesn't bring its parent viewport to front. (#7354)

This commit is contained in:
ocornut 2024-02-27 20:02:26 +01:00
parent 1a487165b1
commit 4e8c43f6b7
2 changed files with 15 additions and 0 deletions

View File

@ -1067,10 +1067,20 @@ static void ImGui_ImplWin32_ShowWindow(ImGuiViewport* viewport)
{
ImGui_ImplWin32_ViewportData* vd = (ImGui_ImplWin32_ViewportData*)viewport->PlatformUserData;
IM_ASSERT(vd->Hwnd != 0);
// ShowParent() also brings parent to front, which is not always desirable,
// so we temporarily disable parenting. (#7354)
if (vd->HwndParent != NULL)
::SetWindowLongPtr(vd->Hwnd, GWLP_HWNDPARENT, (LONG_PTR)nullptr);
if (viewport->Flags & ImGuiViewportFlags_NoFocusOnAppearing)
::ShowWindow(vd->Hwnd, SW_SHOWNA);
else
::ShowWindow(vd->Hwnd, SW_SHOW);
// Restore
if (vd->HwndParent != NULL)
::SetWindowLongPtr(vd->Hwnd, GWLP_HWNDPARENT, (LONG_PTR)vd->HwndParent);
}
static void ImGui_ImplWin32_UpdateWindow(ImGuiViewport* viewport)

View File

@ -46,6 +46,11 @@ Other changes:
it would generally manifest when fast moving the mouse bottom to top in a sub-menu.
(#7325, #7287, #7063)
Docking+Viewports Branch:
- Backends: Win32: made it so that an appearing viewport showing up doesn't bring
its parent to front. (#7354)
-----------------------------------------------------------------------
VERSION 1.90.4 (Released 2024-02-22)