Skip to content

Commit

Permalink
Fix for using tooltips within popup #126 - will need to rewrite the s…
Browse files Browse the repository at this point in the history
…orting/layering system shortly.
  • Loading branch information
ocornut committed Mar 26, 2015
1 parent a3086f4 commit 93c9777
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,7 @@ void ImGui::Render()
}

// Gather windows to render
// FIXME-OPT: Rework this in a more performance conscious way.
g.RenderDrawLists.resize(0);
for (size_t i = 0; i != g.Windows.size(); i++)
{
Expand All @@ -2184,7 +2185,13 @@ void ImGui::Render()
for (size_t i = 0; i != g.Windows.size(); i++)
{
ImGuiWindow* window = g.Windows[i];
if (window->Visible && (window->Flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)))
if (window->Visible && (window->Flags & ImGuiWindowFlags_Popup) != 0)
AddWindowToRenderList(window);
}
for (size_t i = 0; i != g.Windows.size(); i++)
{
ImGuiWindow* window = g.Windows[i];
if (window->Visible && (window->Flags & ImGuiWindowFlags_Tooltip) != 0)
AddWindowToRenderList(window);
}

Expand Down Expand Up @@ -2992,7 +2999,8 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
window->Visible = true;

// New windows appears in front
if (!(flags & ImGuiWindowFlags_ChildWindow))
if (!(flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
{
if (window->LastFrameDrawn < current_frame - 1)
{
FocusWindow(window);
Expand All @@ -3004,6 +3012,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
window->PosFloat = g.IO.MousePos;
}
}
}

window->LastFrameDrawn = current_frame;
window->ClipRectStack.resize(0);
Expand Down Expand Up @@ -9461,11 +9470,13 @@ void ImGui::ShowTestWindow(bool* opened)
{
ImGui::BeginPopup(&popup_open);
for (size_t i = 0; i < IM_ARRAYSIZE(fishes); i++)
{
if (ImGui::Selectable(fishes[i], false))
{
selected_fish = i;
popup_open = false;
}
}
ImGui::EndPopup();
}
ImGui::TreePop();
Expand Down

0 comments on commit 93c9777

Please sign in to comment.