| 7694 | } |
| 7695 | |
| 7696 | void ImGui::SetItemDefaultFocus() |
| 7697 | { |
| 7698 | ImGuiContext& g = *GImGui; |
| 7699 | ImGuiWindow* window = g.CurrentWindow; |
| 7700 | if (!window->Appearing) |
| 7701 | return; |
| 7702 | if (g.NavWindow != window->RootWindowForNav || (!g.NavInitRequest && g.NavInitResult.ID == 0) || g.NavLayer != window->DC.NavLayerCurrent) |
| 7703 | return; |
| 7704 | |
| 7705 | g.NavInitRequest = false; |
| 7706 | NavApplyItemToResult(&g.NavInitResult); |
| 7707 | NavUpdateAnyRequestFlag(); |
| 7708 | |
| 7709 | // Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll) |
| 7710 | if (!window->ClipRect.Contains(g.LastItemData.Rect)) |
| 7711 | ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags_None); |
| 7712 | } |
| 7713 | |
| 7714 | void ImGui::SetStateStorage(ImGuiStorage* tree) |
| 7715 | { |