From 462d167456852387dcc6c3d03f1ad502992108c0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 14 Oct 2024 17:37:36 +0200 Subject: [PATCH] Nav: rectangle highlight not rendered for items with ImGuiItemFlags_NoNav. (#8057) Not fully honored in ItemHoverable/IsItemHovered, seems more destructive. This is mostly designed to avoid rectangle being rendered by large InvisibleButton() when ctrl+tabbing back to a window with a big one. --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 203d4d954..6a062c459 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -72,6 +72,8 @@ Other changes: back into same window later. - Nav: fixed Ctrl+Tab so when starting with no focused window it starts from the top-most window. (#3200) +- Nav: rectangle highlight not rendered for items with ImGuiItemFlags_NoNav. Can be relevant + when e.g activating the item with mouse, then ctrl+tabbing back and forth. - DrawList: AddCallback() added an optional size parameter allowing to copy and store any amount of user data for usage by callbacks: (#6969, #4770, #7665) - If userdata_size == 0: we copy/store the 'userdata' argument as-is (existing behavior). diff --git a/imgui.cpp b/imgui.cpp index eafb7a84d..0ca2f4ab1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3701,6 +3701,8 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl return; if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw)) return; + if (id == g.LastItemData.ID && (g.LastItemData.InFlags & ImGuiItemFlags_NoNav)) + return; ImGuiWindow* window = g.CurrentWindow; if (window->DC.NavHideHighlightOneFrame) return;