From 1c7f3590a2783b912d3f1bd0edce40945487ccd7 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 7 Jun 2023 17:40:59 +0200 Subject: [PATCH] RangeSelect/MultiSelect: Fixed right-click handling in MultiSelectItemFooter() when not focused. --- imgui_widgets.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 3df0a366..519d01d6 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7215,7 +7215,11 @@ void ImGui::MultiSelectItemFooter(ImGuiID id, bool* p_selected, bool* p_pressed) ImGuiMultiSelectState* storage = ms->Storage; if (pressed) ms->IsFocused = true; - if (!ms->IsFocused) + + bool hovered = false; + if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredRect) + hovered = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup); + if (!ms->IsFocused && !hovered) return; void* item_data = (void*)g.NextItemData.SelectionUserData; @@ -7241,7 +7245,6 @@ void ImGui::MultiSelectItemFooter(ImGuiID id, bool* p_selected, bool* p_pressed) // Right-click handling: this could be moved at the Selectable() level. // FIXME-MULTISELECT: See https://github.com/ocornut/imgui/pull/5816 - bool hovered = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup); if (hovered && IsMouseClicked(1)) { if (g.ActiveId != 0 && g.ActiveId != id)