|
@@ -438,6 +438,7 @@ CODE
|
|
|
- likewise io.MousePos and GetMousePos() will use OS coordinates.
|
|
|
If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos.
|
|
|
|
|
|
+ - 2024/06/20 (1.90.9) - renamed ImGuiDragDropFlags_SourceAutoExpirePayload to ImGuiDragDropFlags_PayloadAutoExpire.
|
|
|
- 2024/06/18 (1.90.9) - style: renamed ImGuiCol_TabActive -> ImGuiCol_TabSelected, ImGuiCol_TabUnfocused -> ImGuiCol_TabDimmed, ImGuiCol_TabUnfocusedActive -> ImGuiCol_TabDimmedSelected.
|
|
|
- 2024/06/10 (1.90.9) - removed old nested structure: renaming ImGuiStorage::ImGuiStoragePair type to ImGuiStoragePair (simpler for many languages).
|
|
|
- 2024/06/06 (1.90.8) - reordered ImGuiInputTextFlags values. This should not be breaking unless you are using generated headers that have values not matching the main library.
|
|
@@ -5389,12 +5390,16 @@ void ImGui::EndFrame()
|
|
|
if (g.DragDropActive)
|
|
|
{
|
|
|
bool is_delivered = g.DragDropPayload.Delivery;
|
|
|
- bool is_elapsed = (g.DragDropPayload.DataFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton));
|
|
|
+ bool is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_PayloadAutoExpire) || g.DragDropMouseButton == -1 || !IsMouseDown(g.DragDropMouseButton));
|
|
|
if (is_delivered || is_elapsed)
|
|
|
ClearDragDrop();
|
|
|
}
|
|
|
|
|
|
- // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.
|
|
|
+ // Drag and Drop: Fallback for missing source tooltip. This is not ideal but better than nothing.
|
|
|
+ // If you want to handle source item disappearing: instead of submitting your description tooltip
|
|
|
+ // in the BeginDragDropSource() block of the dragged item, you can submit them from a safe single spot
|
|
|
+ // (e.g. end of your item loop, or before EndFrame) by reading payload data.
|
|
|
+ // In the typical case, the contents of drag tooltip should be possible to infer solely from payload data.
|
|
|
if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip))
|
|
|
{
|
|
|
g.DragDropWithinSource = true;
|
|
@@ -13932,9 +13937,13 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ // When ImGuiDragDropFlags_SourceExtern is set:
|
|
|
window = NULL;
|
|
|
source_id = ImHashStr("#SourceExtern");
|
|
|
source_drag_active = true;
|
|
|
+ mouse_button = g.IO.MouseDown[0] ? 0 : -1;
|
|
|
+ KeepAliveID(source_id);
|
|
|
+ SetActiveID(source_id, NULL);
|
|
|
}
|
|
|
|
|
|
IM_ASSERT(g.DragDropWithinTarget == false); // Can't nest BeginDragDropSource() and BeginDragDropTarget()
|
|
@@ -13946,7 +13955,8 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|
|
{
|
|
|
IM_ASSERT(source_id != 0);
|
|
|
ClearDragDrop();
|
|
|
- IMGUI_DEBUG_LOG_ACTIVEID("[dragdrop] BeginDragDropSource() DragDropActive = true, source_id = %08X\n", source_id);
|
|
|
+ IMGUI_DEBUG_LOG_ACTIVEID("[dragdrop] BeginDragDropSource() DragDropActive = true, source_id = 0x%08X%s\n",
|
|
|
+ source_id, (flags & ImGuiDragDropFlags_SourceExtern) ? " (EXTERN)" : "");
|
|
|
ImGuiPayload& payload = g.DragDropPayload;
|
|
|
payload.SourceId = source_id;
|
|
|
payload.SourceParentId = source_parent_id;
|
|
@@ -14005,7 +14015,7 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s
|
|
|
IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
|
|
|
IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
|
|
|
IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
|
|
|
- IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
|
|
|
+ IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
|
|
|
|
|
|
if (cond == ImGuiCond_Always || payload.DataFrameCount == -1)
|
|
|
{
|
|
@@ -14132,11 +14142,15 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
|
|
|
RenderDragDropTargetRect(r, g.DragDropTargetClipRect);
|
|
|
|
|
|
g.DragDropAcceptFrameCount = g.FrameCount;
|
|
|
- payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting OS window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()
|
|
|
+ if ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) && g.DragDropMouseButton == -1)
|
|
|
+ payload.Delivery = was_accepted_previously && (g.DragDropSourceFrameCount < g.FrameCount);
|
|
|
+ else
|
|
|
+ payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting OS window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()
|
|
|
if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery))
|
|
|
return NULL;
|
|
|
|
|
|
- //IMGUI_DEBUG_LOG("AcceptDragDropPayload(): %08X: return payload\n", g.DragDropTargetId);
|
|
|
+ if (payload.Delivery)
|
|
|
+ IMGUI_DEBUG_LOG_ACTIVEID("[dragdrop] AcceptDragDropPayload(): 0x%08X: payload delivery\n", g.DragDropTargetId);
|
|
|
return &payload;
|
|
|
}
|
|
|
|
|
@@ -20197,6 +20211,11 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
|
|
|
// Basic info
|
|
|
Text("Dear ImGui %s", GetVersion());
|
|
|
+ if (g.ContextName[0] != 0)
|
|
|
+ {
|
|
|
+ SameLine();
|
|
|
+ Text("(Context Name: \"%s\")", g.ContextName);
|
|
|
+ }
|
|
|
Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
|
|
Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
|
|
|
Text("%d visible windows, %d current allocations", io.MetricsRenderWindows, g.DebugAllocInfo.TotalAllocCount - g.DebugAllocInfo.TotalFreeCount);
|
|
@@ -21451,7 +21470,10 @@ void ImGui::DebugLogV(const char* fmt, va_list args)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
const int old_size = g.DebugLogBuf.size();
|
|
|
- g.DebugLogBuf.appendf("[%05d] ", g.FrameCount);
|
|
|
+ if (g.ContextName[0] != 0)
|
|
|
+ g.DebugLogBuf.appendf("[%s] [%05d] ", g.ContextName, g.FrameCount);
|
|
|
+ else
|
|
|
+ g.DebugLogBuf.appendf("[%05d] ", g.FrameCount);
|
|
|
g.DebugLogBuf.appendfv(fmt, args);
|
|
|
g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size());
|
|
|
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
|