Skip to content

Commit 76180ec

Browse files
committed
update imgui to 19110
1 parent a85d708 commit 76180ec

File tree

9 files changed

+72
-36
lines changed

9 files changed

+72
-36
lines changed

imgui/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ endif(IMGUI_STATIC)
11231123

11241124
set(IMGUI_VERSION_MAJOR 1)
11251125
set(IMGUI_VERSION_MINOR 91)
1126-
set(IMGUI_VERSION_PATCH 04)
1126+
set(IMGUI_VERSION_PATCH 10)
11271127
string(TIMESTAMP IMGUI_VERSION_BUILD "%y%m%d")
11281128
set(IMGUI_VERSION_STRING ${IMGUI_VERSION_MAJOR}.${IMGUI_VERSION_MINOR}.${IMGUI_VERSION_PATCH})
11291129
add_definitions(-DIMGUI_VERSION_MAJOR=${IMGUI_VERSION_MAJOR})

imgui/backends/imgui_impl_glfw.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,11 @@ void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows)
590590
}
591591

592592
#ifdef __EMSCRIPTEN__
593-
EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (char const* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); });
593+
#if EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 >= 3'4'0'20240817
594+
void ImGui_ImplGlfw_EmscriptenOpenURL(const char* url) { if (url) emscripten::glfw3::OpenURL(url); }
595+
#else
596+
EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (const char* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); });
597+
#endif
594598
#endif
595599

596600
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)

imgui/imgui.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.91.1 WIP
1+
// dear imgui, v1.91.1
22
// (main code and documentation)
33

44
// Help:
@@ -4485,7 +4485,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
44854485
const float delay = CalcDelayFromHoveredFlags(flags);
44864486
if (delay > 0.0f || (flags & ImGuiHoveredFlags_Stationary))
44874487
{
4488-
ImGuiID hover_delay_id = (g.LastItemData.ID != 0) ? g.LastItemData.ID : window->GetIDFromRectangle(g.LastItemData.Rect);
4488+
ImGuiID hover_delay_id = (g.LastItemData.ID != 0) ? g.LastItemData.ID : window->GetIDFromPos(g.LastItemData.Rect.Min);
44894489
if ((flags & ImGuiHoveredFlags_NoSharedDelay) && (g.HoverItemDelayIdPreviousFrame != hover_delay_id))
44904490
g.HoverItemDelayTimer = 0.0f;
44914491
g.HoverItemDelayId = hover_delay_id;
@@ -9242,6 +9242,16 @@ ImGuiID ImGuiWindow::GetID(int n)
92429242
}
92439243

92449244
// This is only used in rare/specific situations to manufacture an ID out of nowhere.
9245+
// FIXME: Consider instead storing last non-zero ID + count of successive zero-ID, and combine those?
9246+
ImGuiID ImGuiWindow::GetIDFromPos(const ImVec2& p_abs)
9247+
{
9248+
ImGuiID seed = IDStack.back();
9249+
ImVec2 p_rel = ImGui::WindowPosAbsToRel(this, p_abs);
9250+
ImGuiID id = ImHashData(&p_rel, sizeof(p_rel), seed);
9251+
return id;
9252+
}
9253+
9254+
// "
92459255
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
92469256
{
92479257
ImGuiID seed = IDStack.back();
@@ -12338,6 +12348,9 @@ void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_
1233812348
ImGuiContext& g = *GImGui;
1233912349
IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupToLevel(%d), restore_under=%d\n", remaining, restore_focus_to_window_under_popup);
1234012350
IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);
12351+
if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup)
12352+
for (int n = remaining; n < g.OpenPopupStack.Size; n++)
12353+
IMGUI_DEBUG_LOG_POPUP("[popup] - Closing PopupID 0x%08X Window \"%s\"\n", g.OpenPopupStack[n].PopupId, g.OpenPopupStack[n].Window ? g.OpenPopupStack[n].Window->Name : NULL);
1234112354

1234212355
// Trim open popup stack
1234312356
ImGuiPopupData prev_popup = g.OpenPopupStack[remaining];
@@ -20939,7 +20952,7 @@ void ImGui::UpdateDebugToolFlashStyleColor()
2093920952
ImGuiContext& g = *GImGui;
2094020953
if (g.DebugFlashStyleColorTime <= 0.0f)
2094120954
return;
20942-
ColorConvertHSVtoRGB(cosf(g.DebugFlashStyleColorTime * 6.0f) * 0.5f + 0.5f, 0.5f, 0.5f, g.Style.Colors[g.DebugFlashStyleColorIdx].x, g.Style.Colors[g.DebugFlashStyleColorIdx].y, g.Style.Colors[g.DebugFlashStyleColorIdx].z);
20955+
ColorConvertHSVtoRGB(ImCos(g.DebugFlashStyleColorTime * 6.0f) * 0.5f + 0.5f, 0.5f, 0.5f, g.Style.Colors[g.DebugFlashStyleColorIdx].x, g.Style.Colors[g.DebugFlashStyleColorIdx].y, g.Style.Colors[g.DebugFlashStyleColorIdx].z);
2094320956
g.Style.Colors[g.DebugFlashStyleColorIdx].w = 1.0f;
2094420957
if ((g.DebugFlashStyleColorTime -= g.IO.DeltaTime) <= 0.0f)
2094520958
DebugFlashStyleColorStop();

imgui/imgui.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.91.1 WIP
1+
// dear imgui, v1.91.1
22
// (headers)
33

44
// Help:
@@ -28,8 +28,8 @@
2828

2929
// Library Version
3030
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
31-
#define IMGUI_VERSION "1.91.1 WIP"
32-
#define IMGUI_VERSION_NUM 19104
31+
#define IMGUI_VERSION "1.91.1"
32+
#define IMGUI_VERSION_NUM 19110
3333
#define IMGUI_HAS_TABLE
3434
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
3535
#define IMGUI_HAS_DOCK // Docking WIP branch
@@ -674,7 +674,7 @@ namespace ImGui
674674
// - Use the ShowStyleEditor() function to interactively see/edit the colors.
675675
IMGUI_API ImFont* GetFont(); // get current font
676676
IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied
677-
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
677+
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a white pixel, useful to draw custom shapes via the ImDrawList API
678678
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList
679679
IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
680680
IMGUI_API ImU32 GetColorU32(ImU32 col, float alpha_mul = 1.0f); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
@@ -2298,7 +2298,7 @@ enum ImGuiTableColumnFlags_
22982298
ImGuiTableColumnFlags_NoSort = 1 << 9, // Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table).
22992299
ImGuiTableColumnFlags_NoSortAscending = 1 << 10, // Disable ability to sort in the ascending direction.
23002300
ImGuiTableColumnFlags_NoSortDescending = 1 << 11, // Disable ability to sort in the descending direction.
2301-
ImGuiTableColumnFlags_NoHeaderLabel = 1 << 12, // TableHeadersRow() will not submit horizontal label for this column. Convenient for some small columns. Name will still appear in context menu or in angled headers.
2301+
ImGuiTableColumnFlags_NoHeaderLabel = 1 << 12, // TableHeadersRow() will submit an empty label for this column. Convenient for some small columns. Name will still appear in context menu or in angled headers. You may append into this cell by calling TableSetColumnIndex() right after the TableHeadersRow() call.
23022302
ImGuiTableColumnFlags_NoHeaderWidth = 1 << 13, // Disable header text width contribution to automatic column width.
23032303
ImGuiTableColumnFlags_PreferSortAscending = 1 << 14, // Make the initial sort direction Ascending when first sorting on this column (default).
23042304
ImGuiTableColumnFlags_PreferSortDescending = 1 << 15, // Make the initial sort direction Descending when first sorting on this column.
@@ -3897,7 +3897,7 @@ enum ImGuiViewportFlags_
38973897
ImGuiViewportFlags_None = 0,
38983898
ImGuiViewportFlags_IsPlatformWindow = 1 << 0, // Represent a Platform Window
38993899
ImGuiViewportFlags_IsPlatformMonitor = 1 << 1, // Represent a Platform Monitor (unused yet)
3900-
ImGuiViewportFlags_OwnedByApp = 1 << 2, // Platform Window: Was created/managed by the user application? (rather than our backend)
3900+
ImGuiViewportFlags_OwnedByApp = 1 << 2, // Platform Window: Is created/managed by the user application? (rather than our backend)
39013901
ImGuiViewportFlags_NoDecoration = 1 << 3, // Platform Window: Disable platform decorations: title bar, borders, etc. (generally set all windows, but if ImGuiConfigFlags_ViewportsDecoration is set we only set this on popups/tooltips)
39023902
ImGuiViewportFlags_NoTaskBarIcon = 1 << 4, // Platform Window: Disable platform task bar icon (generally set on popups/tooltips, or all windows if ImGuiConfigFlags_ViewportsNoTaskBarIcon is set)
39033903
ImGuiViewportFlags_NoFocusOnAppearing = 1 << 5, // Platform Window: Don't take focus when created.

imgui/imgui_demo.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.91.1 WIP
1+
// dear imgui, v1.91.1
22
// (demo code)
33

44
// Help:
@@ -118,6 +118,9 @@ Index of this file:
118118
#if !defined(_MSC_VER) || _MSC_VER >= 1800
119119
#include <inttypes.h> // PRId64/PRIu64, not avail in some MinGW headers.
120120
#endif
121+
#ifdef __EMSCRIPTEN__
122+
#include <emscripten/version.h> // __EMSCRIPTEN_major__ etc.
123+
#endif
121124

122125
// Visual Studio warnings
123126
#ifdef _MSC_VER
@@ -2104,6 +2107,10 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
21042107
ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));
21052108
ImGui::Separator();
21062109

2110+
ImGui::Text("Need better plotting and graphing? Consider using ImPlot:");
2111+
ImGui::TextLinkOpenURL("https://github.com/epezent/implot");
2112+
ImGui::Separator();
2113+
21072114
ImGui::TreePop();
21082115
}
21092116

@@ -6527,7 +6534,11 @@ static void ShowDemoWindowTables()
65276534
// FIXME: It would be nice to actually demonstrate full-featured selection using those checkbox.
65286535
static bool column_selected[3] = {};
65296536

6530-
// Instead of calling TableHeadersRow() we'll submit custom headers ourselves
6537+
// Instead of calling TableHeadersRow() we'll submit custom headers ourselves.
6538+
// (A different approach is also possible:
6539+
// - Specify ImGuiTableColumnFlags_NoHeaderLabel in some TableSetupColumn() call.
6540+
// - Call TableHeadersRow() normally. This will submit TableHeader() with no name.
6541+
// - Then call TableSetColumnIndex() to position yourself in the column and submit your stuff e.g. Checkbox().)
65316542
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
65326543
for (int column = 0; column < COLUMNS_COUNT; column++)
65336544
{
@@ -6542,6 +6553,7 @@ static void ShowDemoWindowTables()
65426553
ImGui::PopID();
65436554
}
65446555

6556+
// Submit table contents
65456557
for (int row = 0; row < 5; row++)
65466558
{
65476559
ImGui::TableNextRow();
@@ -6576,6 +6588,7 @@ static void ShowDemoWindowTables()
65766588
ImGui::CheckboxFlags("_ScrollX", &table_flags, ImGuiTableFlags_ScrollX);
65776589
ImGui::CheckboxFlags("_ScrollY", &table_flags, ImGuiTableFlags_ScrollY);
65786590
ImGui::CheckboxFlags("_Resizable", &table_flags, ImGuiTableFlags_Resizable);
6591+
ImGui::CheckboxFlags("_Sortable", &table_flags, ImGuiTableFlags_Sortable);
65796592
ImGui::CheckboxFlags("_NoBordersInBody", &table_flags, ImGuiTableFlags_NoBordersInBody);
65806593
ImGui::CheckboxFlags("_HighlightHoveredColumn", &table_flags, ImGuiTableFlags_HighlightHoveredColumn);
65816594
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
@@ -7821,6 +7834,7 @@ void ImGui::ShowAboutWindow(bool* p_open)
78217834
#endif
78227835
#ifdef __EMSCRIPTEN__
78237836
ImGui::Text("define: __EMSCRIPTEN__");
7837+
ImGui::Text("Emscripten: %d.%d.%d", __EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__);
78247838
#endif
78257839
#ifdef IMGUI_HAS_VIEWPORT
78267840
ImGui::Text("define: IMGUI_HAS_VIEWPORT");

imgui/imgui_draw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.91.1 WIP
1+
// dear imgui, v1.91.1
22
// (drawing and font code)
33

44
/*

imgui/imgui_internal.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.91.1 WIP
1+
// dear imgui, v1.91.1
22
// (internal structures/api)
33

44
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
@@ -2088,7 +2088,7 @@ struct ImGuiViewportP : public ImGuiViewport
20882088

20892089
// Calculate work rect pos/size given a set of offset (we have 1 pair of offset for rect locked from last frame data, and 1 pair for currently building rect)
20902090
ImVec2 CalcWorkRectPos(const ImVec2& inset_min) const { return ImVec2(Pos.x + inset_min.x, Pos.y + inset_min.y); }
2091-
ImVec2 CalcWorkRectSize(const ImVec2& inset_min, const ImVec2& inset_max) const { return ImVec2(ImMax(0.0f, Size.x - inset_min.x - inset_max.x), ImMax(0.0f, Size.y - inset_min.y + inset_max.y)); }
2091+
ImVec2 CalcWorkRectSize(const ImVec2& inset_min, const ImVec2& inset_max) const { return ImVec2(ImMax(0.0f, Size.x - inset_min.x - inset_max.x), ImMax(0.0f, Size.y - inset_min.y - inset_max.y)); }
20922092
void UpdateWorkRect() { WorkPos = CalcWorkRectPos(WorkInsetMin); WorkSize = CalcWorkRectSize(WorkInsetMin, WorkInsetMax); } // Update public fields
20932093

20942094
// Helpers to retrieve ImRect (we don't need to store BuildWorkRect as every access tend to change it, hence the code asymmetry)
@@ -3078,6 +3078,7 @@ struct IMGUI_API ImGuiWindow
30783078
ImGuiID GetID(const char* str, const char* str_end = NULL);
30793079
ImGuiID GetID(const void* ptr);
30803080
ImGuiID GetID(int n);
3081+
ImGuiID GetIDFromPos(const ImVec2& p_abs);
30813082
ImGuiID GetIDFromRectangle(const ImRect& r_abs);
30823083

30833084
// We don't use g.FontSize because the window may be != g.CurrentWindow.
@@ -3191,6 +3192,7 @@ struct ImGuiTableColumn
31913192
float MaxX;
31923193
float WidthRequest; // Master width absolute value when !(Flags & _WidthStretch). When Stretch this is derived every frame from StretchWeight in TableUpdateLayout()
31933194
float WidthAuto; // Automatic width
3195+
float WidthMax; // Maximum width (FIXME: overwritten by each instance)
31943196
float StretchWeight; // Master width weight when (Flags & _WidthStretch). Often around ~1.0f initially.
31953197
float InitStretchWeightOrWidth; // Value passed to TableSetupColumn(). For Width it is a content width (_without padding_).
31963198
ImRect ClipRect; // Clipping rectangle for the column
@@ -3492,8 +3494,8 @@ namespace ImGui
34923494
inline void SetWindowParentWindowForFocusRoute(ImGuiWindow* window, ImGuiWindow* parent_window) { window->ParentWindowForFocusRoute = parent_window; } // You may also use SetNextWindowClass()'s FocusRouteParentWindowId field.
34933495
inline ImRect WindowRectAbsToRel(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x - off.x, r.Min.y - off.y, r.Max.x - off.x, r.Max.y - off.y); }
34943496
inline ImRect WindowRectRelToAbs(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x + off.x, r.Min.y + off.y, r.Max.x + off.x, r.Max.y + off.y); }
3495-
inline ImVec2 WindowPosRelToAbs(ImGuiWindow* window, const ImVec2& p) { ImVec2 off = window->DC.CursorStartPos; return ImVec2(p.x + off.x, p.y + off.y); }
34963497
inline ImVec2 WindowPosAbsToRel(ImGuiWindow* window, const ImVec2& p) { ImVec2 off = window->DC.CursorStartPos; return ImVec2(p.x - off.x, p.y - off.y); }
3498+
inline ImVec2 WindowPosRelToAbs(ImGuiWindow* window, const ImVec2& p) { ImVec2 off = window->DC.CursorStartPos; return ImVec2(p.x + off.x, p.y + off.y); }
34973499

34983500
// Windows: Display Order and Focus Order
34993501
IMGUI_API void FocusWindow(ImGuiWindow* window, ImGuiFocusRequestFlags flags = 0);
@@ -3897,7 +3899,7 @@ namespace ImGui
38973899
IMGUI_API ImRect TableGetCellBgRect(const ImGuiTable* table, int column_n);
38983900
IMGUI_API const char* TableGetColumnName(const ImGuiTable* table, int column_n);
38993901
IMGUI_API ImGuiID TableGetColumnResizeID(ImGuiTable* table, int column_n, int instance_no = 0);
3900-
IMGUI_API float TableGetMaxColumnWidth(const ImGuiTable* table, int column_n);
3902+
IMGUI_API float TableCalcMaxColumnWidth(const ImGuiTable* table, int column_n);
39013903
IMGUI_API void TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n);
39023904
IMGUI_API void TableSetColumnWidthAutoAll(ImGuiTable* table);
39033905
IMGUI_API void TableRemove(ImGuiTable* table);

0 commit comments

Comments
 (0)