Nav: SetActiveId() uses SetActiveIDNoNav() to avoid duplicating logic. (#787)

docking
omar 7 years ago
parent 2047c58efb
commit f0d437dd9c

@ -1941,7 +1941,7 @@ ImGuiWindow* ImGui::GetParentWindow()
return g.CurrentWindowStack[(unsigned int)g.CurrentWindowStack.Size - 2];
}
void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
void ImGui::SetActiveIDNoNav(ImGuiID id, ImGuiWindow* window)
{
ImGuiContext& g = *GImGui;
g.ActiveIdIsJustActivated = (g.ActiveId != id);
@ -1953,6 +1953,15 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
{
g.ActiveIdIsAlive = true;
g.ActiveIdSource = (g.NavActivateId == id || g.NavInputId == id || g.NavJustTabbedId == id || g.NavJustNavigatedId == id) ? ImGuiInputSource_Nav : ImGuiInputSource_Mouse;
}
}
void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
{
ImGuiContext& g = *GImGui;
SetActiveIDNoNav(id, window);
if (id)
{
if (g.ActiveIdSource == ImGuiInputSource_Nav)
g.NavDisableMouseHover = true;
else
@ -1965,21 +1974,6 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
}
}
void ImGui::SetActiveIDNoNav(ImGuiID id, ImGuiWindow* window)
{
ImGuiContext& g = *GImGui;
g.ActiveIdIsJustActivated = (g.ActiveId != id);
g.ActiveId = id;
g.ActiveIdAllowNavDirFlags = 0;
g.ActiveIdAllowOverlap = false;
g.ActiveIdWindow = window;
if (id)
{
g.ActiveIdIsAlive = true;
g.ActiveIdSource = (g.NavActivateId == id || g.NavInputId == id) ? ImGuiInputSource_Nav : ImGuiInputSource_Mouse;
}
}
void ImGui::ClearActiveID()
{
SetActiveID(0, NULL);

Loading…
Cancel
Save