Inputs: SetItemKeyOwner(): does not set ownership is key is already taken.

(#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641)
This commit is contained in:
ocornut
2026-05-07 21:22:02 +02:00
parent 0eae77f783
commit 56b37bf93c
3 changed files with 7 additions and 1 deletions

View File

@@ -10726,6 +10726,8 @@ bool ImGui::SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags)
if ((g.HoveredId == id && (flags & ImGuiInputFlags_CondHovered)) || (g.ActiveId == id && (flags & ImGuiInputFlags_CondActive)))
{
IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetItemKeyOwner) == 0); // Passing flags not supported by this function!
if (!TestKeyOwner(key, id))
return false;
SetKeyOwner(key, id, flags & ~ImGuiInputFlags_CondMask_);
return true;
}