Skip to content

Commit

Permalink
Drag and Drop: fixed GetDragDropPayload() returning a non-NULL value …
Browse files Browse the repository at this point in the history
…before payload is submitted. (ocornut#5910, ocornut#143)

+ Added test "widgets_dragdrop_new_payloads" in Test Suite.
  • Loading branch information
ocornut authored and kjblanchard committed May 5, 2023
1 parent 7d649d3 commit d3bd3cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ HOW TO UPDATE?
inside a collapsed/culled window and IMGUI_DISABLE_OBSOLETE_FUNCTIONS is enabled. (#5548, #5911)
- ColorEdit: fixed label overlapping when using style.ColorButtonPosition == ImGuiDir_Left to
move the color button on the left side (regression introduced in 1.88 WIP 2022/02/28). (#5912)
- Drag and Drop: fixed GetDragDropPayload() returning a non-NULL value if a drag source is
active but a payload hasn't been submitted yet. This is convenient to detect new payload
from within a drag source handler. (#5910, #143)
- Backends: GLFW: cancel out errors emitted by glfwGetKeyName() when a name is missing. (#5908)


Expand Down
2 changes: 1 addition & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12023,7 +12023,7 @@ void ImGui::RenderDragDropTargetRect(const ImRect& bb)
const ImGuiPayload* ImGui::GetDragDropPayload()
{
ImGuiContext& g = *GImGui;
return g.DragDropActive ? &g.DragDropPayload : NULL;
return (g.DragDropActive && g.DragDropPayload.DataFrameCount != -1) ? &g.DragDropPayload : NULL;
}

// We don't really use/need this now, but added it for the sake of consistency and because we might need it later.
Expand Down

0 comments on commit d3bd3cb

Please sign in to comment.