From 392ab0858062040133ba8896e30344bf8182a6bb Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 20 May 2019 16:46:26 +0200 Subject: [PATCH] BeginPopupContextItem(): Skip processing when SkipItems is set as LastItemId is unreliable and we assert when it is zero. + Minor comments on columns. --- imgui.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 5334a35f..46ecb3ca 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7229,6 +7229,8 @@ void ImGui::EndPopup() bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button) { ImGuiWindow* window = GImGui->CurrentWindow; + if (window->SkipItems) + return false; ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict! IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item) if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) @@ -8435,7 +8437,8 @@ void ImGui::NextColumn() columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y); if (++columns->Current < columns->Count) { - // New column (columns 1+ cancels out IndentX) + // Columns 1+ cancel out IndentX + // FIXME-COLUMNS: Unnecessary, could be locked? window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + g.Style.ItemSpacing.x; window->DrawList->ChannelsSetCurrent(columns->Current + 1); } @@ -8452,7 +8455,7 @@ void ImGui::NextColumn() window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); window->DC.CurrLineTextBaseOffset = 0.0f; - PushColumnClipRect(columns->Current); + PushColumnClipRect(columns->Current); // FIXME-COLUMNS: Could it be an overwrite? PushItemWidth(GetColumnWidth() * 0.65f); // FIXME-COLUMNS: Move on columns setup }