|
|
@@ -691,14 +691,12 @@
|
|
|
#pragma clang diagnostic ignored "-Wunused-function" // warning : 'xxxx' defined but not used
|
|
|
#pragma clang diagnostic ignored "-Wformat-pedantic" // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic.
|
|
|
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
|
|
|
-#pragma clang diagnostic ignored "-Wcast-qual" // warning : cast from 'const xxxx *' to 'xxxx *' drops const qualifier
|
|
|
#elif defined(__GNUC__)
|
|
|
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
|
|
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size
|
|
|
#pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*'
|
|
|
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
|
|
|
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
|
|
|
-#pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'const xxxx *' to type 'xxxx *' casts away qualifiers
|
|
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked
|
|
|
#pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
|
|
|
#endif
|
|
|
@@ -3250,7 +3248,7 @@ static void ImGui::NavUpdate()
|
|
|
g.NavScoringCount = 0;
|
|
|
#if IMGUI_DEBUG_NAV_RECTS
|
|
|
if (g.NavWindow) { for (int layer = 0; layer < 2; layer++) g.OverlayDrawList.AddRect(g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Min, g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Max, IM_COL32(255,200,0,255)); } // [DEBUG]
|
|
|
- if (g.NavWindow) { ImU32 col = (g.NavWindow->HiddenFrames <= 0) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredMousePos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); g.OverlayDrawList.AddCircleFilled(p, 3.0f, col); g.OverlayDrawList.AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); }
|
|
|
+ if (g.NavWindow) { ImU32 col = (g.NavWindow->HiddenFrames == 0) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredMousePos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); g.OverlayDrawList.AddCircleFilled(p, 3.0f, col); g.OverlayDrawList.AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); }
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
@@ -3766,7 +3764,7 @@ static void LoadIniSettingsFromMemory(const char* buf_readonly)
|
|
|
line_end[-1] = 0;
|
|
|
const char* name_end = line_end - 1;
|
|
|
const char* type_start = line + 1;
|
|
|
- char* type_end = (char*)ImStrchrRange(type_start, name_end, ']');
|
|
|
+ char* type_end = (char*)(intptr_t)ImStrchrRange(type_start, name_end, ']');
|
|
|
const char* name_start = type_end ? ImStrchrRange(type_end + 1, name_end, '[') : NULL;
|
|
|
if (!type_end || !name_start)
|
|
|
{
|
|
|
@@ -3842,8 +3840,8 @@ static void MarkIniSettingsDirty(ImGuiWindow* window)
|
|
|
// FIXME: Add a more explicit sort order in the window structure.
|
|
|
static int IMGUI_CDECL ChildWindowComparer(const void* lhs, const void* rhs)
|
|
|
{
|
|
|
- const ImGuiWindow* a = *(const ImGuiWindow**)lhs;
|
|
|
- const ImGuiWindow* b = *(const ImGuiWindow**)rhs;
|
|
|
+ const ImGuiWindow* const a = *(const ImGuiWindow* const *)lhs;
|
|
|
+ const ImGuiWindow* const b = *(const ImGuiWindow* const *)rhs;
|
|
|
if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup))
|
|
|
return d;
|
|
|
if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip))
|
|
|
@@ -3907,7 +3905,7 @@ static void AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWin
|
|
|
for (int i = 0; i < window->DC.ChildWindows.Size; i++)
|
|
|
{
|
|
|
ImGuiWindow* child = window->DC.ChildWindows[i];
|
|
|
- if (child->Active && child->HiddenFrames <= 0) // clipped children may have been marked not active
|
|
|
+ if (child->Active && child->HiddenFrames == 0) // clipped children may have been marked not active
|
|
|
AddWindowToDrawData(out_render_list, child);
|
|
|
}
|
|
|
}
|
|
|
@@ -4075,10 +4073,10 @@ void ImGui::Render()
|
|
|
for (int n = 0; n != g.Windows.Size; n++)
|
|
|
{
|
|
|
ImGuiWindow* window = g.Windows[n];
|
|
|
- if (window->Active && window->HiddenFrames <= 0 && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != window_to_render_front_most)
|
|
|
+ if (window->Active && window->HiddenFrames == 0 && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != window_to_render_front_most)
|
|
|
AddWindowToDrawDataSelectLayer(window);
|
|
|
}
|
|
|
- if (window_to_render_front_most && window_to_render_front_most->Active && window_to_render_front_most->HiddenFrames <= 0) // NavWindowingTarget is always temporarily displayed as the front-most window
|
|
|
+ if (window_to_render_front_most && window_to_render_front_most->Active && window_to_render_front_most->HiddenFrames == 0) // NavWindowingTarget is always temporarily displayed as the front-most window
|
|
|
AddWindowToDrawDataSelectLayer(window_to_render_front_most);
|
|
|
g.DrawDataBuilder.FlattenIntoSingleLayer();
|
|
|
|
|
|
@@ -4778,7 +4776,7 @@ void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_
|
|
|
if (ImGuiWindow* window = FindWindowByName(window_name))
|
|
|
if (window->Active)
|
|
|
{
|
|
|
- // Hide previous tooltips. We can't easily "reset" the content of a window so we create a new one.
|
|
|
+ // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
|
|
|
window->HiddenFrames = 1;
|
|
|
ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount);
|
|
|
}
|
|
|
@@ -4830,6 +4828,7 @@ void ImGui::OpenPopupEx(ImGuiID id)
|
|
|
popup_ref.OpenMousePos = g.IO.MousePos;
|
|
|
popup_ref.OpenPopupPos = (!g.NavDisableHighlight && g.NavDisableMouseHover) ? NavCalcPreferredMousePos() : g.IO.MousePos;
|
|
|
|
|
|
+ //printf("[%05d] OpenPopupEx(0x%08X)\n", g.FrameCount, id);
|
|
|
if (g.OpenPopupStack.Size < current_stack_size + 1)
|
|
|
{
|
|
|
g.OpenPopupStack.push_back(popup_ref);
|
|
|
@@ -5100,7 +5099,7 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|
|
|
|
|
char title[256];
|
|
|
if (name)
|
|
|
- ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s_%08X", parent_window->Name, name, id);
|
|
|
+ ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s", parent_window->Name, name);
|
|
|
else
|
|
|
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id);
|
|
|
|
|
|
@@ -5601,7 +5600,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
// Find or create
|
|
|
ImGuiWindow* window = FindWindowByName(name);
|
|
|
- if (!window)
|
|
|
+ const bool window_just_created = (window == NULL);
|
|
|
+ if (window_just_created)
|
|
|
{
|
|
|
ImVec2 size_on_first_use = (g.NextWindowData.SizeCond != 0) ? g.NextWindowData.SizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here.
|
|
|
window = CreateNewWindow(name, size_on_first_use, flags);
|
|
|
@@ -5623,7 +5623,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
// Update the Appearing flag
|
|
|
bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
|
|
|
- const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFrames == 1);
|
|
|
+ const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFrames > 0);
|
|
|
if (flags & ImGuiWindowFlags_Popup)
|
|
|
{
|
|
|
ImGuiPopupRef& popup_ref = g.OpenPopupStack[g.CurrentPopupStack.Size];
|
|
|
@@ -5732,7 +5732,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
// Lock window rounding, border size and rounding so that altering the border sizes for children doesn't have side-effects.
|
|
|
window->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding;
|
|
|
- window->WindowBorderSize = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildBorderSize : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;
|
|
|
+ window->WindowBorderSize = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildBorderSize : ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;
|
|
|
window->WindowPadding = style.WindowPadding;
|
|
|
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_Popup)) && window->WindowBorderSize == 0.0f)
|
|
|
window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);
|
|
|
@@ -5763,7 +5763,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
// Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)
|
|
|
if (window->HiddenFrames > 0)
|
|
|
window->HiddenFrames--;
|
|
|
- if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && window_just_activated_by_user)
|
|
|
+ if (window_just_activated_by_user && (flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0)
|
|
|
{
|
|
|
window->HiddenFrames = 1;
|
|
|
if (flags & ImGuiWindowFlags_AlwaysAutoResize)
|
|
|
@@ -5776,10 +5776,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Hide new windows for one frame until they calculate their size
|
|
|
+ if (window_just_created && (!window_size_x_set_by_api || !window_size_y_set_by_api))
|
|
|
+ window->HiddenFrames = 1;
|
|
|
+
|
|
|
// Calculate auto-fit size, handle automatic resize
|
|
|
const ImVec2 size_auto_fit = CalcSizeAutoFit(window, window->SizeContents);
|
|
|
ImVec2 size_full_modified(FLT_MAX, FLT_MAX);
|
|
|
- if (flags & ImGuiWindowFlags_AlwaysAutoResize && !window->Collapsed)
|
|
|
+ if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed)
|
|
|
{
|
|
|
// Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.
|
|
|
if (!window_size_x_set_by_api)
|
|
|
@@ -5789,7 +5793,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
}
|
|
|
else if (window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
|
|
|
{
|
|
|
- // Auto-fit only grows during the first few frames
|
|
|
+ // Auto-fit may only grow window during the first few frames
|
|
|
// We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.
|
|
|
if (!window_size_x_set_by_api && window->AutoFitFramesX > 0)
|
|
|
window->SizeFull.x = size_full_modified.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x;
|
|
|
@@ -6396,6 +6400,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|
|
g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId
|
|
|
g.NavIdIsAlive = false;
|
|
|
g.NavLayer = 0;
|
|
|
+ //printf("[%05d] FocusWindow(\"%s\")\n", g.FrameCount, window ? window->Name : NULL);
|
|
|
}
|
|
|
|
|
|
// Passing NULL allow to disable keyboard focus
|
|
|
@@ -6850,6 +6855,8 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
|
|
|
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
|
|
if (cond && (window->SetWindowPosAllowFlags & cond) == 0)
|
|
|
return;
|
|
|
+
|
|
|
+ IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
|
|
window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
|
|
window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX);
|
|
|
|
|
|
@@ -6884,6 +6891,8 @@ static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond con
|
|
|
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
|
|
if (cond && (window->SetWindowSizeAllowFlags & cond) == 0)
|
|
|
return;
|
|
|
+
|
|
|
+ IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
|
|
window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
|
|
|
|
|
// Set
|
|
|
@@ -6975,6 +6984,7 @@ void ImGui::SetWindowFocus(const char* name)
|
|
|
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pivot)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
|
|
g.NextWindowData.PosVal = pos;
|
|
|
g.NextWindowData.PosPivotVal = pivot;
|
|
|
g.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always;
|
|
|
@@ -6983,6 +6993,7 @@ void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pi
|
|
|
void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
|
|
g.NextWindowData.SizeVal = size;
|
|
|
g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always;
|
|
|
}
|
|
|
@@ -7006,6 +7017,7 @@ void ImGui::SetNextWindowContentSize(const ImVec2& size)
|
|
|
void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
|
|
g.NextWindowData.CollapsedVal = collapsed;
|
|
|
g.NextWindowData.CollapsedCond = cond ? cond : ImGuiCond_Always;
|
|
|
}
|
|
|
@@ -12939,14 +12951,14 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s
|
|
|
// Store in heap
|
|
|
g.DragDropPayloadBufHeap.resize((int)data_size);
|
|
|
payload.Data = g.DragDropPayloadBufHeap.Data;
|
|
|
- memcpy((void*)payload.Data, data, data_size);
|
|
|
+ memcpy((void*)(intptr_t)payload.Data, data, data_size);
|
|
|
}
|
|
|
else if (data_size > 0)
|
|
|
{
|
|
|
// Store locally
|
|
|
memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
|
|
|
payload.Data = g.DragDropPayloadBufLocal;
|
|
|
- memcpy((void*)payload.Data, data, data_size);
|
|
|
+ memcpy((void*)(intptr_t)payload.Data, data, data_size);
|
|
|
}
|
|
|
else
|
|
|
{
|