|
|
@@ -1,4 +1,4 @@
|
|
|
-// dear imgui, v1.90.4
|
|
|
+// dear imgui, v1.90.5
|
|
|
// (main code and documentation)
|
|
|
|
|
|
// Help:
|
|
|
@@ -7,15 +7,19 @@
|
|
|
// - Read top of imgui.cpp for more details, links and comments.
|
|
|
|
|
|
// Resources:
|
|
|
-// - FAQ https://dearimgui.com/faq
|
|
|
-// - Getting Started https://dearimgui.com/getting-started
|
|
|
-// - Homepage https://github.com/ocornut/imgui
|
|
|
-// - Releases & changelog https://github.com/ocornut/imgui/releases
|
|
|
-// - Gallery https://github.com/ocornut/imgui/issues/6897 (please post your screenshots/video there!)
|
|
|
-// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
|
|
-// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
|
|
-// - Issues & support https://github.com/ocornut/imgui/issues
|
|
|
-// - Tests & Automation https://github.com/ocornut/imgui_test_engine
|
|
|
+// - FAQ ........................ https://dearimgui.com/faq (in repository as docs/FAQ.md)
|
|
|
+// - Homepage ................... https://github.com/ocornut/imgui
|
|
|
+// - Releases & changelog ....... https://github.com/ocornut/imgui/releases
|
|
|
+// - Gallery .................... https://github.com/ocornut/imgui/issues/6897 (please post your screenshots/video there!)
|
|
|
+// - Wiki ....................... https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
|
|
+// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started (how to integrate in an existing app by adding ~25 lines of code)
|
|
|
+// - Third-party Extensions https://github.com/ocornut/imgui/wiki/Useful-Extensions (ImPlot & many more)
|
|
|
+// - Bindings/Backends https://github.com/ocornut/imgui/wiki/Bindings (language bindings, backends for various tech/engines)
|
|
|
+// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
|
|
+// - Debug Tools https://github.com/ocornut/imgui/wiki/Debug-Tools
|
|
|
+// - Software using Dear ImGui https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui
|
|
|
+// - Issues & support ........... https://github.com/ocornut/imgui/issues
|
|
|
+// - Test Engine & Automation ... https://github.com/ocornut/imgui_test_engine (test suite, test engine to automate your apps)
|
|
|
|
|
|
// For first-time users having issues compiling/linking/running/loading fonts:
|
|
|
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
|
|
@@ -26,7 +30,7 @@
|
|
|
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
|
|
// This library is free but needs your support to sustain development and maintenance.
|
|
|
// Businesses: you can support continued development via B2B invoiced technical support, maintenance and sponsoring contracts.
|
|
|
-// PLEASE reach out at omar AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Sponsors
|
|
|
+// PLEASE reach out at omar AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Funding
|
|
|
// Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
|
|
|
|
|
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
|
|
@@ -73,6 +77,7 @@ CODE
|
|
|
// [SECTION] RENDER HELPERS
|
|
|
// [SECTION] INITIALIZATION, SHUTDOWN
|
|
|
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
|
|
+// [SECTION] ID STACK
|
|
|
// [SECTION] INPUTS
|
|
|
// [SECTION] ERROR CHECKING
|
|
|
// [SECTION] ITEM SUBMISSION
|
|
|
@@ -425,6 +430,9 @@ CODE
|
|
|
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
|
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
+ - 2024/03/18 (1.90.5) - merged the radius_x/radius_y parameters in ImDrawList::AddEllipse(), AddEllipseFilled() and PathEllipticalArcTo() into a single ImVec2 parameter. Exceptionally, because those functions were added in 1.90, we are not adding inline redirection functions. The transition is easy and should affect few users. (#2743, #7417)
|
|
|
+ - 2024/03/08 (1.90.5) - inputs: more formally obsoleted GetKeyIndex() when IMGUI_DISABLE_OBSOLETE_FUNCTIONS is set. It has been unnecessary and a no-op since 1.87 (it returns the same value as passed when used with a 1.87+ backend using io.AddKeyEvent() function). (#4921)
|
|
|
+ - IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
|
|
|
- 2024/01/15 (1.90.2) - commented out obsolete ImGuiIO::ImeWindowHandle marked obsolete in 1.87, favor of writing to 'void* ImGuiViewport::PlatformHandleRaw'.
|
|
|
- 2023/12/19 (1.90.1) - commented out obsolete ImGuiKey_KeyPadEnter redirection to ImGuiKey_KeypadEnter.
|
|
|
- 2023/11/06 (1.90.1) - removed CalcListClipping() marked obsolete in 1.86. Prefer using ImGuiListClipper which can return non-contiguous ranges.
|
|
|
@@ -935,7 +943,7 @@ CODE
|
|
|
A: - Businesses: please reach out to "omar AT dearimgui DOT com" if you work in a place using Dear ImGui!
|
|
|
We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts.
|
|
|
This is among the most useful thing you can do for Dear ImGui. With increased funding, we sustain and grow work on this project.
|
|
|
- Also see https://github.com/ocornut/imgui/wiki/Sponsors
|
|
|
+ >>> See https://github.com/ocornut/imgui/wiki/Funding
|
|
|
- Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
|
|
- If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, and see how you want to help and can help!
|
|
|
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
|
|
@@ -1028,6 +1036,7 @@ CODE
|
|
|
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning: zero as null pointer constant // some standard header variations use #define NULL 0
|
|
|
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
|
|
|
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
|
|
|
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access
|
|
|
#elif defined(__GNUC__)
|
|
|
// We disable -Wpragmas because GCC doesn't provide a has_warning equivalent and some forks/patches may not follow the warning/version association.
|
|
|
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
|
|
@@ -1198,7 +1207,7 @@ ImGuiStyle::ImGuiStyle()
|
|
|
FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
|
|
|
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
|
|
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
|
|
- CellPadding = ImVec2(4,2); // Padding within a table cell. CellPadding.y may be altered between different rows.
|
|
|
+ CellPadding = ImVec2(4,2); // Padding within a table cell. Cellpadding.x is locked for entire table. CellPadding.y may be altered between different rows.
|
|
|
TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
|
|
IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
|
|
|
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
|
|
@@ -3125,7 +3134,9 @@ static const ImGuiDataVarInfo GStyleVarInfo[] =
|
|
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize
|
|
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
|
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding
|
|
|
+ { ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabBorderSize) }, // ImGuiStyleVar_TabBorderSize
|
|
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabBarBorderSize) }, // ImGuiStyleVar_TabBarBorderSize
|
|
|
+ { ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TableAngledHeadersAngle)},// ImGuiStyleVar_TableAngledHeadersAngle
|
|
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign
|
|
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign
|
|
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, SeparatorTextBorderSize)},// ImGuiStyleVar_SeparatorTextBorderSize
|
|
|
@@ -3774,45 +3785,6 @@ ImGuiWindow::~ImGuiWindow()
|
|
|
ColumnsStorage.clear_destruct();
|
|
|
}
|
|
|
|
|
|
-ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)
|
|
|
-{
|
|
|
- ImGuiID seed = IDStack.back();
|
|
|
- ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
|
|
- ImGuiContext& g = *Ctx;
|
|
|
- if (g.DebugHookIdInfo == id)
|
|
|
- ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
|
|
- return id;
|
|
|
-}
|
|
|
-
|
|
|
-ImGuiID ImGuiWindow::GetID(const void* ptr)
|
|
|
-{
|
|
|
- ImGuiID seed = IDStack.back();
|
|
|
- ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);
|
|
|
- ImGuiContext& g = *Ctx;
|
|
|
- if (g.DebugHookIdInfo == id)
|
|
|
- ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL);
|
|
|
- return id;
|
|
|
-}
|
|
|
-
|
|
|
-ImGuiID ImGuiWindow::GetID(int n)
|
|
|
-{
|
|
|
- ImGuiID seed = IDStack.back();
|
|
|
- ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
|
|
- ImGuiContext& g = *Ctx;
|
|
|
- if (g.DebugHookIdInfo == id)
|
|
|
- ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
|
|
- return id;
|
|
|
-}
|
|
|
-
|
|
|
-// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
|
|
-ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
|
|
-{
|
|
|
- ImGuiID seed = IDStack.back();
|
|
|
- ImRect r_rel = ImGui::WindowRectAbsToRel(this, r_abs);
|
|
|
- ImGuiID id = ImHashData(&r_rel, sizeof(r_rel), seed);
|
|
|
- return id;
|
|
|
-}
|
|
|
-
|
|
|
static void SetCurrentWindow(ImGuiWindow* window)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
@@ -5894,7 +5866,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
|
|
|
|
|
int ret_auto_fit_mask = 0x00;
|
|
|
const float grip_draw_size = IM_TRUNC(ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
|
|
|
- const float grip_hover_inner_size = IM_TRUNC(grip_draw_size * 0.75f);
|
|
|
+ const float grip_hover_inner_size = (resize_grip_count > 0) ? IM_TRUNC(grip_draw_size * 0.75f) : 0.0f;
|
|
|
const float grip_hover_outer_size = g.IO.ConfigWindowsResizeFromEdges ? WINDOWS_HOVER_PADDING : 0.0f;
|
|
|
|
|
|
ImRect clamp_rect = visibility_rect;
|
|
|
@@ -6022,10 +5994,13 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
|
|
border_target = ImClamp(border_target, clamp_min, clamp_max);
|
|
|
if (flags & ImGuiWindowFlags_ChildWindow) // Clamp resizing of childs within parent
|
|
|
{
|
|
|
- if ((flags & (ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar)) == 0 || (flags & ImGuiWindowFlags_NoScrollbar))
|
|
|
- border_target.x = ImClamp(border_target.x, window->ParentWindow->InnerClipRect.Min.x, window->ParentWindow->InnerClipRect.Max.x);
|
|
|
- if (flags & ImGuiWindowFlags_NoScrollbar)
|
|
|
- border_target.y = ImClamp(border_target.y, window->ParentWindow->InnerClipRect.Min.y, window->ParentWindow->InnerClipRect.Max.y);
|
|
|
+ ImGuiWindowFlags parent_flags = window->ParentWindow->Flags;
|
|
|
+ ImRect border_limit_rect = window->ParentWindow->InnerRect;
|
|
|
+ border_limit_rect.Expand(ImVec2(-ImMax(window->WindowPadding.x, window->WindowBorderSize), -ImMax(window->WindowPadding.y, window->WindowBorderSize)));
|
|
|
+ if ((parent_flags & (ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar)) == 0 || (parent_flags & ImGuiWindowFlags_NoScrollbar))
|
|
|
+ border_target.x = ImClamp(border_target.x, border_limit_rect.Min.x, border_limit_rect.Max.x);
|
|
|
+ if (parent_flags & ImGuiWindowFlags_NoScrollbar)
|
|
|
+ border_target.y = ImClamp(border_target.y, border_limit_rect.Min.y, border_limit_rect.Max.y);
|
|
|
}
|
|
|
if (!ignore_resize)
|
|
|
CalcResizePosSizeFromAnyCorner(window, border_target, ImMin(def.SegmentN1, def.SegmentN2), &pos_target, &size_target);
|
|
|
@@ -6465,7 +6440,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
PushFocusScope((flags & ImGuiWindowFlags_NavFlattened) ? g.CurrentFocusScopeId : window->ID);
|
|
|
window->NavRootFocusScopeId = g.CurrentFocusScopeId;
|
|
|
|
|
|
- // Add to popup stack
|
|
|
+ // Add to popup stacks: update OpenPopupStack[] data, push to BeginPopupStack[]
|
|
|
if (flags & ImGuiWindowFlags_Popup)
|
|
|
{
|
|
|
ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];
|
|
|
@@ -6612,8 +6587,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x);
|
|
|
window->DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y;
|
|
|
|
|
|
+ // Depending on condition we use previous or current window size to compare against contents size to decide if a scrollbar should be visible.
|
|
|
+ // Those flags will be altered further down in the function depending on more conditions.
|
|
|
bool use_current_size_for_scrollbar_x = window_just_created;
|
|
|
bool use_current_size_for_scrollbar_y = window_just_created;
|
|
|
+ if (window_size_x_set_by_api && window->ContentSizeExplicit.x != 0.0f)
|
|
|
+ use_current_size_for_scrollbar_x = true;
|
|
|
+ if (window_size_y_set_by_api && window->ContentSizeExplicit.y != 0.0f) // #7252
|
|
|
+ use_current_size_for_scrollbar_y = true;
|
|
|
|
|
|
// Collapse window by double-clicking on title bar
|
|
|
// At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing
|
|
|
@@ -6621,8 +6602,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
{
|
|
|
// We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), so verify that we don't have items over the title bar.
|
|
|
ImRect title_bar_rect = window->TitleBarRect();
|
|
|
- if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) && g.IO.MouseClickedCount[0] == 2)
|
|
|
- window->WantCollapseToggle = true;
|
|
|
+ if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max))
|
|
|
+ if (g.IO.MouseClickedCount[0] == 2 && GetKeyOwner(ImGuiKey_MouseLeft) == ImGuiKeyOwner_None)
|
|
|
+ window->WantCollapseToggle = true;
|
|
|
if (window->WantCollapseToggle)
|
|
|
{
|
|
|
window->Collapsed = !window->Collapsed;
|
|
|
@@ -7966,6 +7948,69 @@ ImGuiStorage* ImGui::GetStateStorage()
|
|
|
return window->DC.StateStorage;
|
|
|
}
|
|
|
|
|
|
+bool ImGui::IsRectVisible(const ImVec2& size)
|
|
|
+{
|
|
|
+ ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
+ return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));
|
|
|
+}
|
|
|
+
|
|
|
+bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
|
|
+{
|
|
|
+ ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
+ return window->ClipRect.Overlaps(ImRect(rect_min, rect_max));
|
|
|
+}
|
|
|
+
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
+// [SECTION] ID STACK
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
+
|
|
|
+// This is one of the very rare legacy case where we use ImGuiWindow methods,
|
|
|
+// it should ideally be flattened at some point but it's been used a lots by widgets.
|
|
|
+ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)
|
|
|
+{
|
|
|
+ ImGuiID seed = IDStack.back();
|
|
|
+ ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
|
|
+#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
+ ImGuiContext& g = *Ctx;
|
|
|
+ if (g.DebugHookIdInfo == id)
|
|
|
+ ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
|
|
+#endif
|
|
|
+ return id;
|
|
|
+}
|
|
|
+
|
|
|
+ImGuiID ImGuiWindow::GetID(const void* ptr)
|
|
|
+{
|
|
|
+ ImGuiID seed = IDStack.back();
|
|
|
+ ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);
|
|
|
+#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
+ ImGuiContext& g = *Ctx;
|
|
|
+ if (g.DebugHookIdInfo == id)
|
|
|
+ ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL);
|
|
|
+#endif
|
|
|
+ return id;
|
|
|
+}
|
|
|
+
|
|
|
+ImGuiID ImGuiWindow::GetID(int n)
|
|
|
+{
|
|
|
+ ImGuiID seed = IDStack.back();
|
|
|
+ ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
|
|
+#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
+ ImGuiContext& g = *Ctx;
|
|
|
+ if (g.DebugHookIdInfo == id)
|
|
|
+ ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
|
|
+#endif
|
|
|
+ return id;
|
|
|
+}
|
|
|
+
|
|
|
+// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
|
|
+ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
|
|
+{
|
|
|
+ ImGuiID seed = IDStack.back();
|
|
|
+ ImRect r_rel = ImGui::WindowRectAbsToRel(this, r_abs);
|
|
|
+ ImGuiID id = ImHashData(&r_rel, sizeof(r_rel), seed);
|
|
|
+ return id;
|
|
|
+}
|
|
|
+
|
|
|
void ImGui::PushID(const char* str_id)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
@@ -8003,8 +8048,10 @@ void ImGui::PushOverrideID(ImGuiID id)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
+#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
if (g.DebugHookIdInfo == id)
|
|
|
DebugHookIdInfo(id, ImGuiDataType_ID, NULL, NULL);
|
|
|
+#endif
|
|
|
window->IDStack.push_back(id);
|
|
|
}
|
|
|
|
|
|
@@ -8014,18 +8061,22 @@ void ImGui::PushOverrideID(ImGuiID id)
|
|
|
ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed)
|
|
|
{
|
|
|
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
|
|
+#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
if (g.DebugHookIdInfo == id)
|
|
|
DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
|
|
+#endif
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
ImGuiID ImGui::GetIDWithSeed(int n, ImGuiID seed)
|
|
|
{
|
|
|
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
|
|
+#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
if (g.DebugHookIdInfo == id)
|
|
|
DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
|
|
+#endif
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
@@ -8054,19 +8105,6 @@ ImGuiID ImGui::GetID(const void* ptr_id)
|
|
|
return window->GetID(ptr_id);
|
|
|
}
|
|
|
|
|
|
-bool ImGui::IsRectVisible(const ImVec2& size)
|
|
|
-{
|
|
|
- ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
- return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));
|
|
|
-}
|
|
|
-
|
|
|
-bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
|
|
-{
|
|
|
- ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
- return window->ClipRect.Overlaps(ImRect(rect_min, rect_max));
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// [SECTION] INPUTS
|
|
|
//-----------------------------------------------------------------------------
|
|
|
@@ -9197,7 +9235,7 @@ void ImGui::SetNextFrameWantCaptureMouse(bool want_capture_mouse)
|
|
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
static const char* GetInputSourceName(ImGuiInputSource source)
|
|
|
{
|
|
|
- const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Clipboard" };
|
|
|
+ const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad" };
|
|
|
IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT && source >= 0 && source < ImGuiInputSource_COUNT);
|
|
|
return input_source_names[source];
|
|
|
}
|
|
|
@@ -10776,7 +10814,7 @@ void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags)
|
|
|
ImGuiPopupData popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.
|
|
|
popup_ref.PopupId = id;
|
|
|
popup_ref.Window = NULL;
|
|
|
- popup_ref.BackupNavWindow = g.NavWindow; // When popup closes focus may be restored to NavWindow (depend on window type).
|
|
|
+ popup_ref.RestoreNavWindow = g.NavWindow; // When popup closes focus may be restored to NavWindow (depend on window type).
|
|
|
popup_ref.OpenFrameCount = g.FrameCount;
|
|
|
popup_ref.OpenParentId = parent_window->IDStack.back();
|
|
|
popup_ref.OpenPopupPos = NavCalcPreferredRefPos();
|
|
|
@@ -10825,6 +10863,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
|
|
|
return;
|
|
|
|
|
|
// Don't close our own child popup windows.
|
|
|
+ //IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupsOverWindow(\"%s\") restore_under=%d\n", ref_window ? ref_window->Name : "<NULL>", restore_focus_to_window_under_popup);
|
|
|
int popup_count_to_keep = 0;
|
|
|
if (ref_window)
|
|
|
{
|
|
|
@@ -10881,18 +10920,19 @@ void ImGui::ClosePopupsExceptModals()
|
|
|
void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\n", remaining, restore_focus_to_window_under_popup);
|
|
|
+ IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupToLevel(%d), restore_under=%d\n", remaining, restore_focus_to_window_under_popup);
|
|
|
IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);
|
|
|
|
|
|
// Trim open popup stack
|
|
|
- ImGuiWindow* popup_window = g.OpenPopupStack[remaining].Window;
|
|
|
- ImGuiWindow* popup_backup_nav_window = g.OpenPopupStack[remaining].BackupNavWindow;
|
|
|
+ ImGuiPopupData prev_popup = g.OpenPopupStack[remaining];
|
|
|
g.OpenPopupStack.resize(remaining);
|
|
|
|
|
|
- if (restore_focus_to_window_under_popup)
|
|
|
+ // Restore focus (unless popup window was not yet submitted, and didn't have a chance to take focus anyhow. See #7325 for an edge case)
|
|
|
+ if (restore_focus_to_window_under_popup && prev_popup.Window)
|
|
|
{
|
|
|
- ImGuiWindow* focus_window = (popup_window && popup_window->Flags & ImGuiWindowFlags_ChildMenu) ? popup_window->ParentWindow : popup_backup_nav_window;
|
|
|
- if (focus_window && !focus_window->WasActive && popup_window)
|
|
|
+ ImGuiWindow* popup_window = prev_popup.Window;
|
|
|
+ ImGuiWindow* focus_window = (popup_window->Flags & ImGuiWindowFlags_ChildMenu) ? popup_window->ParentWindow : prev_popup.RestoreNavWindow;
|
|
|
+ if (focus_window && !focus_window->WasActive)
|
|
|
FocusTopMostWindowUnderOne(popup_window, NULL, NULL, ImGuiFocusRequestFlags_RestoreFocusedChild); // Fallback
|
|
|
else
|
|
|
FocusWindow(focus_window, (g.NavLayer == ImGuiNavLayer_Main) ? ImGuiFocusRequestFlags_RestoreFocusedChild : ImGuiFocusRequestFlags_None);
|
|
|
@@ -12284,8 +12324,10 @@ void ImGui::NavMoveRequestApplyResult()
|
|
|
g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid;
|
|
|
}
|
|
|
|
|
|
- // FIXME: Could become optional e.g. ImGuiNavMoveFlags_NoClearActiveId if we later want to apply navigation requests without altering active input.
|
|
|
- if (g.ActiveId != result->ID)
|
|
|
+ // Clear active id unless requested not to
|
|
|
+ // FIXME: ImGuiNavMoveFlags_NoClearActiveId is currently unused as we don't have a clear strategy to preserve active id after interaction,
|
|
|
+ // so this is mostly provided as a gateway for further experiments (see #1418, #2890)
|
|
|
+ if (g.ActiveId != result->ID && (g.NavMoveFlags & ImGuiNavMoveFlags_NoClearActiveId) == 0)
|
|
|
ClearActiveID();
|
|
|
|
|
|
// Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
|
|
|
@@ -14456,9 +14498,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
{
|
|
|
// As it's difficult to interact with tree nodes while popups are open, we display everything inline.
|
|
|
ImGuiWindow* window = popup_data.Window;
|
|
|
- BulletText("PopupID: %08x, Window: '%s' (%s%s), BackupNavWindow '%s', ParentWindow '%s'",
|
|
|
+ BulletText("PopupID: %08x, Window: '%s' (%s%s), RestoreNavWindow '%s', ParentWindow '%s'",
|
|
|
popup_data.PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? "Child;" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? "Menu;" : "",
|
|
|
- popup_data.BackupNavWindow ? popup_data.BackupNavWindow->Name : "NULL", window && window->ParentWindow ? window->ParentWindow->Name : "NULL");
|
|
|
+ popup_data.RestoreNavWindow ? popup_data.RestoreNavWindow->Name : "NULL", window && window->ParentWindow ? window->ParentWindow->Name : "NULL");
|
|
|
}
|
|
|
TreePop();
|
|
|
}
|