Skip to content

Commit

Permalink
Nav: Fixed entering child with PadActivate not setting ActiveIdSource…
Browse files Browse the repository at this point in the history
… to Nav (#323)
  • Loading branch information
ocornut committed Aug 21, 2016
1 parent 43ee5d7 commit ea2425a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4321,6 +4321,7 @@ bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border,
FocusWindow(child_window);
NavInitWindow(child_window, false);
SetActiveIDNoNav(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item
GImGui->ActiveIdSource = ImGuiInputSource_Nav;
}

return ret;
Expand Down Expand Up @@ -10728,10 +10729,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
}
if (ImGui::TreeNode("Basic state"))
{
const char* input_source_names[] = { "None", "Mouse", "Nav" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_Count_);
ImGui::Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL");
ImGui::Text("HoveredRootWindow: '%s'", g.HoveredRootWindow ? g.HoveredRootWindow->Name : "NULL");
ImGui::Text("HoveredId: 0x%08X/0x%08X", g.HoveredId, g.HoveredIdPreviousFrame); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
ImGui::Text("ActiveId: 0x%08X/0x%08X, ActiveIdWindow: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
ImGui::Text("ActiveId: 0x%08X/0x%08X, ActiveIdSource: %s", g.ActiveId, g.ActiveIdPreviousFrame, input_source_names[g.ActiveIdSource]);
ImGui::Text("ActiveIdWindow: '%s", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
ImGui::Text("NavWindow: '%s', NavId: 0x%08X, NavLayer: %d", g.NavWindow ? g.NavWindow->Name : "NULL", g.NavId, g.NavLayer);
ImGui::Text("NavRefRectRel: (%.1f,%.1f)(%.1f,%.1f)", g.NavRefRectRel.Min.x, g.NavRefRectRel.Min.y, g.NavRefRectRel.Max.x, g.NavRefRectRel.Max.y);
ImGui::Text("NavUsable: %d, NavActive: %d", g.IO.NavUsable, g.IO.NavActive);
Expand Down
1 change: 1 addition & 0 deletions imgui_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ enum ImGuiInputSource
ImGuiInputSource_None = 0,
ImGuiInputSource_Mouse,
ImGuiInputSource_Nav,
ImGuiInputSource_Count_,
};

enum ImGuiNavDir
Expand Down

0 comments on commit ea2425a

Please sign in to comment.