|
432 | 432 | - likewise io.MousePos and GetMousePos() will use OS coordinates.
|
433 | 433 | If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos.
|
434 | 434 |
|
| 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. |
435 | 438 | - 2023/11/09 (1.90.0) - removed IM_OFFSETOF() macro in favor of using offsetof() available in C++11. Kept redirection define (will obsolete).
|
436 | 439 | - 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).
|
437 | 440 | 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()
|
2783 | 2786 | return (g.CurrentTable ? g.CurrentTable->HostSkipItems : g.CurrentWindow->SkipItems);
|
2784 | 2787 | }
|
2785 | 2788 |
|
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 |
| - |
2834 | 2789 | static void ImGuiListClipper_SortAndFuseRanges(ImVector<ImGuiListClipperRange>& ranges, int offset = 0)
|
2835 | 2790 | {
|
2836 | 2791 | if (ranges.Size - offset <= 1)
|
@@ -6014,7 +5969,7 @@ static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window)
|
6014 | 5969 | {
|
6015 | 5970 | ImGuiWindow* window_for_height = GetWindowForTitleAndMenuHeight(window);
|
6016 | 5971 | 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; |
6018 | 5973 | 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
|
6019 | 5974 | }
|
6020 | 5975 | return size_min;
|
@@ -8940,22 +8895,25 @@ static int CalcRoutingScore(ImGuiWindow* location, ImGuiID owner_id, ImGuiInputF
|
8940 | 8895 | if (owner_id != 0 && g.ActiveId == owner_id)
|
8941 | 8896 | return 1;
|
8942 | 8897 |
|
| 8898 | + // Early out when not in focus stack |
| 8899 | + if (focused == NULL || focused->RootWindow != location->RootWindow) |
| 8900 | + return 255; |
| 8901 | + |
8943 | 8902 | // Score based on distance to focused window (lower is better)
|
8944 | 8903 | // Assuming both windows are submitting a routing request,
|
8945 | 8904 | // - When Window....... is focused -> Window scores 3 (best), Window/ChildB scores 255 (no match)
|
8946 | 8905 | // - When Window/ChildB is focused -> Window scores 4, Window/ChildB scores 3 (best)
|
8947 | 8906 | // Assuming only WindowA is submitting a routing request,
|
8948 | 8907 | // - 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) |
8951 | 8911 | {
|
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; |
8958 | 8914 | }
|
| 8915 | + focused = (focused->RootWindow != focused) ? focused->ParentWindow : NULL; // FIXME: This could be later abstracted as a focus path |
| 8916 | + } |
8959 | 8917 | return 255;
|
8960 | 8918 | }
|
8961 | 8919 |
|
@@ -10552,14 +10510,18 @@ void ImGui::PushMultiItemsWidths(int components, float w_full)
|
10552 | 10510 | {
|
10553 | 10511 | ImGuiContext& g = *GImGui;
|
10554 | 10512 | ImGuiWindow* window = g.CurrentWindow;
|
| 10513 | + IM_ASSERT(components > 0); |
10555 | 10514 | 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))); |
10558 | 10515 | 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; |
10563 | 10525 | g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;
|
10564 | 10526 | }
|
10565 | 10527 |
|
@@ -10813,7 +10775,7 @@ static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)
|
10813 | 10775 | }
|
10814 | 10776 | scroll[axis] = scroll_target - center_ratio * (window->SizeFull[axis] - decoration_size[axis]);
|
10815 | 10777 | }
|
10816 |
| - scroll[axis] = IM_TRUNC(ImMax(scroll[axis], 0.0f)); |
| 10778 | + scroll[axis] = IM_ROUND(ImMax(scroll[axis], 0.0f)); |
10817 | 10779 | if (!window->Collapsed && !window->SkipItems)
|
10818 | 10780 | scroll[axis] = ImMin(scroll[axis], window->ScrollMax[axis]);
|
10819 | 10781 | }
|
@@ -12737,7 +12699,7 @@ void ImGui::NavMoveRequestApplyResult()
|
12737 | 12699 | g.NavNextActivateId = result->ID;
|
12738 | 12700 | g.NavNextActivateFlags = ImGuiActivateFlags_None;
|
12739 | 12701 | if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing)
|
12740 |
| - g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState; |
| 12702 | + g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState | ImGuiActivateFlags_FromTabbing; |
12741 | 12703 | }
|
12742 | 12704 |
|
12743 | 12705 | // Enable nav highlight
|
@@ -20275,6 +20237,14 @@ void ImGui::DebugNodeDockNode(ImGuiDockNode* node, const char* label)
|
20275 | 20237 | }
|
20276 | 20238 | }
|
20277 | 20239 |
|
| 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 | + |
20278 | 20248 | // [DEBUG] Display contents of ImDrawList
|
20279 | 20249 | // Note that both 'window' and 'viewport' may be NULL here. Viewport is generally null of destroyed popups which previously owned a viewport.
|
20280 | 20250 | 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
|
20311 | 20281 | continue;
|
20312 | 20282 | }
|
20313 | 20283 |
|
| 20284 | + char texid_desc[20]; |
| 20285 | + FormatTextureIDForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), pcmd->TextureId); |
20314 | 20286 | 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); |
20318 | 20289 | bool pcmd_node_open = TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
|
20319 | 20290 | if (IsItemHovered() && (cfg->ShowDrawCmdMesh || cfg->ShowDrawCmdBoundingBoxes) && fg_draw_list)
|
20320 | 20291 | DebugNodeDrawCmdShowMeshAndBoundingBox(fg_draw_list, draw_list, pcmd, cfg->ShowDrawCmdMesh, cfg->ShowDrawCmdBoundingBoxes);
|
|
0 commit comments