Viewports: clear ImGuiViewportFlags_NoFocusOnAppearing for modals.

Honestly I'm not sure about side-effects but intuitively not needed. Dragging windows will still forcefully set this.
Fixes e.g. appearing modal not taking focus = in win32 implementation it stops task bar icons from appearing (which is to be investigated).
This commit is contained in:
ocornut 2026-11-03 18:41:25 +01:00
parent d682dc41f5
commit 0aaf44d165
3 changed files with 10 additions and 0 deletions

View File

@ -1258,6 +1258,7 @@ static void ImGui_ImplWin32_ShowWindow(ImGuiViewport* viewport)
::ShowWindow(vd->Hwnd, SW_SHOW);
// Restore
// FIXME: Note that setting parent also disable task bar icon, which is sort of unexpected and both params are picked separately.
if (avoid_bringing_parent_to_front)
::SetWindowLongPtr(vd->Hwnd, GWLP_HWNDPARENT, (LONG_PTR)vd->HwndParent);
}

View File

@ -102,6 +102,13 @@ Other Changes:
Made the script detect the environment when needed (e.g. to specify library path).
- Examples: added support for ARM64 in selected build_win.bat helpers. (#9593) [@Harishmcw]
Docking+Viewports Branch:
- Viewports:
- Fixed an issue where in some code paths, a newly created modal in its own
viewport would be created with `ImGuiViewportFlags_NoFocusOnAppearing`.
On some backends this would prevent the task bar icon from showing.
-----------------------------------------------------------------------
VERSION 1.93.0 (Released 2026-10-14)

View File

@ -17501,6 +17501,8 @@ ImGuiViewportP* ImGui::AddUpdateViewport(ImGuiWindow* window, ImGuiID id, const
const bool window_can_use_inputs = ((window->Flags & ImGuiWindowFlags_NoMouseInputs) && (window->Flags & ImGuiWindowFlags_NoNavInputs)) == false;
if (g.MovingWindow && g.MovingWindow->RootWindowDockTree == window)
flags |= ImGuiViewportFlags_NoInputs | ImGuiViewportFlags_NoFocusOnAppearing;
else if (window->Flags & ImGuiWindowFlags_Modal)
flags &= ~ImGuiViewportFlags_NoFocusOnAppearing;
if (!window_can_use_inputs)
flags |= ImGuiViewportFlags_NoInputs;
if (window->Flags & ImGuiWindowFlags_NoFocusOnAppearing)