Skip to content

Commit 8add6bc

Browse files
committed
Merge remote-tracking branch 'origin/master' into docking
# Conflicts: # imgui.cpp # imgui.h
2 parents 96b5b17 + 6cfe3dd commit 8add6bc

8 files changed

+295
-303
lines changed

backends/imgui_impl_android.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ int32_t ImGui_ImplAndroid_HandleInputEvent(const AInputEvent* input_event)
184184
case AKEY_EVENT_ACTION_UP:
185185
{
186186
ImGuiKey key = ImGui_ImplAndroid_KeyCodeToImGuiKey(event_key_code);
187-
if (key != ImGuiKey_None && (event_action == AKEY_EVENT_ACTION_DOWN || event_action == AKEY_EVENT_ACTION_UP))
187+
if (key != ImGuiKey_None)
188188
{
189189
io.AddKeyEvent(key, event_action == AKEY_EVENT_ACTION_DOWN);
190190
io.SetKeyEventNativeData(key, event_key_code, event_scan_code);

docs/CHANGELOG.txt

+23
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,41 @@ HOW TO UPDATE?
4242

4343
Breaking changes:
4444

45+
- DragScalarN, SliderScalarN, InputScalarN: Fixed incorrect pushes into ItemWidth
46+
stack when number of components is 1. [#7095] [@Nahor]
47+
- imgui_freetype: commented out ImGuiFreeType::BuildFontAtlas() obsoleted in 1.81.
48+
Prefer using #define IMGUI_ENABLE_FREETYPE or see commented code for manual calls.
49+
- Removed CalcListClipping() marked obsolete in 1.86. (#3841)
50+
Prefer using ImGuiListClipper which can return non-contiguous ranges.
51+
- Internals, Columns: commented out legacy ImGuiColumnsFlags_XXX symbols redirecting
52+
to ImGuiOldColumnsFlags_XXX, obsoleted from imgui_internal.h in 1.80.
53+
4554
Other changes:
4655

4756
- Windows: BeginChild(): Fixed auto-resizing erroneously limiting size to host viewport
4857
minus padding. There are no limit to a child width/height. (#7063) [@Devyre]
58+
- Windows: Fixed some auto-resizing path using style.WindowMinSize.x (instead of x/y)
59+
for both axises since 1.90. (#7106) [@n0bodysec]
60+
- Scrolling: internal scrolling value is rounded instead of truncated, as a way to reduce
61+
speed asymetry when (incorrectly) attempting to scroll by non-integer amount. (#6677)
4962
- Nav, IO: SetNextFrameWantCaptureKeyboard(false) calls are not overrided back to true when
5063
navigation is enabled. SetNextFrameWantCaptureKeyboard() is always higher priority. (#6997)
5164
- Drag and Drop: Fixed drop target highlight on items temporarily pushing a widened clip rect
5265
(namely Selectables and Treenodes using SpanAllColumn flag) so the highlight properly covers
5366
all columns. (#7049, #4281, #3272)
67+
- InputTextMultiline: Fixed Tab character input not repeating (1.89.4 regression).
68+
- InputTextMultiline: Tabbing through a multi-line text editor which allows Tab character inputs
69+
(using the ImGuiInputTextFlags_AllowTabInput flag) doesn't automatically activate it, in order
70+
to allow passing through multiple widgets easily. (#3092, #5759, #787)
71+
- DragScalarN, SliderScalarN, InputScalarN, PushMultiItemsWidths: improve multi-components
72+
width computation to better distribute the error. (#7120, #7121) [@Nahor]
5473
- Menus: Tweaked hover slack logic, adding a timer to avoid situations where a slow vertical
5574
movements toward another parent BeginMenu() can keep the wrong child menu open. (#6671, #6926)
5675
- Debug Tools: Added DebugFlashStyleColor() to identify a style color. Added to Style Editor.
5776
- Misc: Added IMGUI_USER_H_FILENAME to change the path included when using
5877
IMGUI_INCLUDE_IMGUI_USER_H. (#7039) [@bryceberger]
78+
- Misc: Rework debug display of texture id in Metrics window to avoid compile-error when
79+
ImTextureID is defined to be larger than 64-bits. (#7090)
5980
- Misc: Added extra courtesy ==/!= operators when IMGUI_DEFINE_MATH_OPERATORS is defined.
6081
- Misc: Fixed text functions fast-path for handling "%s" and "%.*s" to handle null pointers gracefully,
6182
like most printf implementations. (#7016, #3466, #6846) [@codefrog2002]
@@ -3850,6 +3871,8 @@ Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v
38503871

38513872
Breaking Changes:
38523873

3874+
- Tabs: Added ImGuiTabItemFlags_NoAssumedClosure to enable app to react on closure attempt, without having to draw
3875+
an unsaved document marker (ImGuiTabItemFlags_UnsavedDocument sets _NoAssumedClosure automatically). (#7084)
38533876
- DragInt(): The default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally
38543877
any more. If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
38553878
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d,

imgui.cpp

+39-68
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ CODE
432432
- likewise io.MousePos and GetMousePos() will use OS coordinates.
433433
If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos.
434434

435+
- 2023/12/06 (1.90.1) - removed CalcListClipping() marked obsolete in 1.86. Prefer using ImGuiListClipper which can return non-contiguous ranges.
436+
- 2023/12/05 (1.90.1) - imgui_freetype: commented out ImGuiFreeType::BuildFontAtlas() obsoleted in 1.81. prefer using #define IMGUI_ENABLE_FREETYPE or see commented code for manual calls.
437+
- 2023/12/05 (1.90.1) - internals,columns: commented out legacy ImGuiColumnsFlags_XXX symbols redirecting to ImGuiOldColumnsFlags_XXX, obsoleted from imgui_internal.h in 1.80.
435438
- 2023/11/09 (1.90.0) - removed IM_OFFSETOF() macro in favor of using offsetof() available in C++11. Kept redirection define (will obsolete).
436439
- 2023/11/07 (1.90.0) - removed BeginChildFrame()/EndChildFrame() in favor of using BeginChild() with the ImGuiChildFlags_FrameStyle flag. kept inline redirection function (will obsolete).
437440
those functions were merely PushStyle/PopStyle helpers, the removal isn't so much motivated by needing to add the feature in BeginChild(), but by the necessity to avoid BeginChildFrame() signature mismatching BeginChild() signature and features.
@@ -2783,54 +2786,6 @@ static bool GetSkipItemForListClipping()
27832786
return (g.CurrentTable ? g.CurrentTable->HostSkipItems : g.CurrentWindow->SkipItems);
27842787
}
27852788

2786-
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2787-
// Legacy helper to calculate coarse clipping of large list of evenly sized items.
2788-
// This legacy API is not ideal because it assumes we will return a single contiguous rectangle.
2789-
// Prefer using ImGuiListClipper which can returns non-contiguous ranges.
2790-
void ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end)
2791-
{
2792-
ImGuiContext& g = *GImGui;
2793-
ImGuiWindow* window = g.CurrentWindow;
2794-
if (g.LogEnabled)
2795-
{
2796-
// If logging is active, do not perform any clipping
2797-
*out_items_display_start = 0;
2798-
*out_items_display_end = items_count;
2799-
return;
2800-
}
2801-
if (GetSkipItemForListClipping())
2802-
{
2803-
*out_items_display_start = *out_items_display_end = 0;
2804-
return;
2805-
}
2806-
2807-
// We create the union of the ClipRect and the scoring rect which at worst should be 1 page away from ClipRect
2808-
// We don't include g.NavId's rectangle in there (unless g.NavJustMovedToId is set) because the rectangle enlargement can get costly.
2809-
ImRect rect = window->ClipRect;
2810-
if (g.NavMoveScoringItems)
2811-
rect.Add(g.NavScoringNoClipRect);
2812-
if (g.NavJustMovedToId && window->NavLastIds[0] == g.NavJustMovedToId)
2813-
rect.Add(WindowRectRelToAbs(window, window->NavRectRel[0])); // Could store and use NavJustMovedToRectRel
2814-
2815-
const ImVec2 pos = window->DC.CursorPos;
2816-
int start = (int)((rect.Min.y - pos.y) / items_height);
2817-
int end = (int)((rect.Max.y - pos.y) / items_height);
2818-
2819-
// When performing a navigation request, ensure we have one item extra in the direction we are moving to
2820-
// FIXME: Verify this works with tabbing
2821-
const bool is_nav_request = (g.NavMoveScoringItems && g.NavWindow && g.NavWindow->RootWindowForNav == window->RootWindowForNav);
2822-
if (is_nav_request && g.NavMoveClipDir == ImGuiDir_Up)
2823-
start--;
2824-
if (is_nav_request && g.NavMoveClipDir == ImGuiDir_Down)
2825-
end++;
2826-
2827-
start = ImClamp(start, 0, items_count);
2828-
end = ImClamp(end + 1, start, items_count);
2829-
*out_items_display_start = start;
2830-
*out_items_display_end = end;
2831-
}
2832-
#endif
2833-
28342789
static void ImGuiListClipper_SortAndFuseRanges(ImVector<ImGuiListClipperRange>& ranges, int offset = 0)
28352790
{
28362791
if (ranges.Size - offset <= 1)
@@ -6014,7 +5969,7 @@ static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window)
60145969
{
60155970
ImGuiWindow* window_for_height = GetWindowForTitleAndMenuHeight(window);
60165971
size_min.x = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f;
6017-
size_min.y = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f;
5972+
size_min.y = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.y : 4.0f;
60185973
size_min.y = ImMax(size_min.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows
60195974
}
60205975
return size_min;
@@ -8940,22 +8895,25 @@ static int CalcRoutingScore(ImGuiWindow* location, ImGuiID owner_id, ImGuiInputF
89408895
if (owner_id != 0 && g.ActiveId == owner_id)
89418896
return 1;
89428897

8898+
// Early out when not in focus stack
8899+
if (focused == NULL || focused->RootWindow != location->RootWindow)
8900+
return 255;
8901+
89438902
// Score based on distance to focused window (lower is better)
89448903
// Assuming both windows are submitting a routing request,
89458904
// - When Window....... is focused -> Window scores 3 (best), Window/ChildB scores 255 (no match)
89468905
// - When Window/ChildB is focused -> Window scores 4, Window/ChildB scores 3 (best)
89478906
// Assuming only WindowA is submitting a routing request,
89488907
// - When Window/ChildB is focused -> Window scores 4 (best), Window/ChildB doesn't have a score.
8949-
if (focused != NULL && focused->RootWindow == location->RootWindow)
8950-
for (int next_score = 3; focused != NULL; next_score++)
8908+
for (int next_score = 3; focused != NULL; next_score++)
8909+
{
8910+
if (focused == location)
89518911
{
8952-
if (focused == location)
8953-
{
8954-
IM_ASSERT(next_score < 255);
8955-
return next_score;
8956-
}
8957-
focused = (focused->RootWindow != focused) ? focused->ParentWindow : NULL; // FIXME: This could be later abstracted as a focus path
8912+
IM_ASSERT(next_score < 255);
8913+
return next_score;
89588914
}
8915+
focused = (focused->RootWindow != focused) ? focused->ParentWindow : NULL; // FIXME: This could be later abstracted as a focus path
8916+
}
89598917
return 255;
89608918
}
89618919

@@ -10552,14 +10510,18 @@ void ImGui::PushMultiItemsWidths(int components, float w_full)
1055210510
{
1055310511
ImGuiContext& g = *GImGui;
1055410512
ImGuiWindow* window = g.CurrentWindow;
10513+
IM_ASSERT(components > 0);
1055510514
const ImGuiStyle& style = g.Style;
10556-
const float w_item_one = ImMax(1.0f, IM_TRUNC((w_full - (style.ItemInnerSpacing.x) * (components - 1)) / (float)components));
10557-
const float w_item_last = ImMax(1.0f, IM_TRUNC(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components - 1)));
1055810515
window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); // Backup current width
10559-
window->DC.ItemWidthStack.push_back(w_item_last);
10560-
for (int i = 0; i < components - 2; i++)
10561-
window->DC.ItemWidthStack.push_back(w_item_one);
10562-
window->DC.ItemWidth = (components == 1) ? w_item_last : w_item_one;
10516+
float w_items = w_full - style.ItemInnerSpacing.x * (components - 1);
10517+
float prev_split = w_items;
10518+
for (int i = components - 1; i > 0; i--)
10519+
{
10520+
float next_split = IM_TRUNC(w_items * i / components);
10521+
window->DC.ItemWidthStack.push_back(prev_split - next_split);
10522+
prev_split = next_split;
10523+
}
10524+
window->DC.ItemWidth = prev_split;
1056310525
g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;
1056410526
}
1056510527

@@ -10813,7 +10775,7 @@ static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)
1081310775
}
1081410776
scroll[axis] = scroll_target - center_ratio * (window->SizeFull[axis] - decoration_size[axis]);
1081510777
}
10816-
scroll[axis] = IM_TRUNC(ImMax(scroll[axis], 0.0f));
10778+
scroll[axis] = IM_ROUND(ImMax(scroll[axis], 0.0f));
1081710779
if (!window->Collapsed && !window->SkipItems)
1081810780
scroll[axis] = ImMin(scroll[axis], window->ScrollMax[axis]);
1081910781
}
@@ -12737,7 +12699,7 @@ void ImGui::NavMoveRequestApplyResult()
1273712699
g.NavNextActivateId = result->ID;
1273812700
g.NavNextActivateFlags = ImGuiActivateFlags_None;
1273912701
if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing)
12740-
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState;
12702+
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState | ImGuiActivateFlags_FromTabbing;
1274112703
}
1274212704

1274312705
// Enable nav highlight
@@ -20275,6 +20237,14 @@ void ImGui::DebugNodeDockNode(ImGuiDockNode* node, const char* label)
2027520237
}
2027620238
}
2027720239

20240+
static void FormatTextureIDForDebugDisplay(char* buf, int buf_size, ImTextureID tex_id)
20241+
{
20242+
if (sizeof(tex_id) >= sizeof(void*))
20243+
ImFormatString(buf, buf_size, "0x%p", (void*)*(intptr_t*)(void*)&tex_id);
20244+
else
20245+
ImFormatString(buf, buf_size, "0x%04X", *(int*)(void*)&tex_id);
20246+
}
20247+
2027820248
// [DEBUG] Display contents of ImDrawList
2027920249
// Note that both 'window' and 'viewport' may be NULL here. Viewport is generally null of destroyed popups which previously owned a viewport.
2028020250
void ImGui::DebugNodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, const ImDrawList* draw_list, const char* label)
@@ -20311,10 +20281,11 @@ void ImGui::DebugNodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, con
2031120281
continue;
2031220282
}
2031320283

20284+
char texid_desc[20];
20285+
FormatTextureIDForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), pcmd->TextureId);
2031420286
char buf[300];
20315-
ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd:%5d tris, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
20316-
pcmd->ElemCount / 3, (void*)(intptr_t)pcmd->TextureId,
20317-
pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
20287+
ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd:%5d tris, Tex %s, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
20288+
pcmd->ElemCount / 3, texid_desc, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
2031820289
bool pcmd_node_open = TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
2031920290
if (IsItemHovered() && (cfg->ShowDrawCmdMesh || cfg->ShowDrawCmdBoundingBoxes) && fg_draw_list)
2032020291
DebugNodeDrawCmdShowMeshAndBoundingBox(fg_draw_list, draw_list, pcmd, cfg->ShowDrawCmdMesh, cfg->ShowDrawCmdBoundingBoxes);

0 commit comments

Comments
 (0)