From f5e66e837c48a559c822da3ce0277b25a119a7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Szathm=C3=A1ry?= Date: Tue, 21 Apr 2026 09:58:40 +0200 Subject: [PATCH] fix(example): disambiguate Drop Target button IDs in Drag'N'Drop demo The demo renders three drop-target buttons whose labels share the same value of the mutable 'data' field, so imgui hashes three identical item IDs within the same window. This was silently broken pre-1.91 (drop zones shared hover/active state) and surfaces as a visible "3 visible items with conflicting ID!" warning now that imgui 1.91's ConfigDebugHighlightIdConflicts is on by default in debug builds. Wrap each drop-target block in a PushID("any"/"string"/"class") / PopID() pair so the buttons share a human-readable label but are distinguished in the ID stack. This is the resolution imgui's own warning recommends first. Co-Authored-By: Claude Opus 4.7 (1M context) --- example/src/main/java/ExampleDragAndDrop.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/example/src/main/java/ExampleDragAndDrop.java b/example/src/main/java/ExampleDragAndDrop.java index a5adb04a..571401a3 100644 --- a/example/src/main/java/ExampleDragAndDrop.java +++ b/example/src/main/java/ExampleDragAndDrop.java @@ -34,20 +34,26 @@ public static void show(final ImBoolean showDragNDropWindow) { ImGui.separator(); ImGui.text("Drop here any:"); + ImGui.pushID("any"); ImGui.button(data, 100, 50); setupTarget(); + ImGui.popID(); ImGui.separator(); ImGui.text("Drop here string payload only"); + ImGui.pushID("string"); ImGui.button(data, 100, 50); setupStringPayloadTarget(); + ImGui.popID(); ImGui.separator(); ImGui.text("Drop here class specific payload only"); + ImGui.pushID("class"); ImGui.button(data, 100, 50); setupClassSpecificPayloadTarget(); + ImGui.popID(); } ImGui.end(); }