1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Nav, Docking, Selection: Fixed tab change from reinitializing navigation state. (#8997)

This commit is contained in:
ocornut 2025-10-14 16:30:30 +02:00
parent 28ed29078b
commit 96ad003000
2 changed files with 7 additions and 3 deletions

View file

@ -140,7 +140,10 @@ Other Changes:
Docking+Viewports Branch:
- Nav: fixed a crash that could occur when opening a popup following the processing
- Nav, Docking, Selection: Fixed tab change from reinitializing navigation state,
which would erroneously clear selection when using ImGuiSelectableFlags_SelectOnNav
or clear multi-selection when not using ImGuiMultiSelectFlags_NoAutoSelect. (#8997)
- Nav: Fixed a crash that could occur when opening a popup following the processing
of a global shortcut while no windows were focused (the fix done in 1.92.3 was
incomplete for docking branch).
- Viewports:

View file

@ -14953,7 +14953,7 @@ static void ImGui::NavUpdateWindowingApplyFocus(ImGuiWindow* apply_focus_window)
FocusWindow(apply_focus_window, ImGuiFocusRequestFlags_RestoreFocusedChild);
IM_ASSERT(g.NavWindow != NULL);
apply_focus_window = g.NavWindow;
if (apply_focus_window->NavLastIds[0] == 0)
if (apply_focus_window->NavLastIds[0] == 0) // FIXME: This is the equivalent of the 'if (g.NavId == 0) { NavInitWindow() }' in DockNodeUpdateTabBar().
NavInitWindow(apply_focus_window, false);
// If the window has ONLY a menu layer (no main layer), select it directly
@ -19366,7 +19366,8 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
if (tab->Window)
{
FocusWindow(tab->Window);
NavInitWindow(tab->Window, false);
if (g.NavId == 0) // only init if FocusWindow() didn't restore anything.
NavInitWindow(tab->Window, false);
}
EndTabBar();