From f01a6d3e8fe7de24fe76e33888b50a82d6808ea4 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 4 Nov 2021 19:49:39 +0100 Subject: [PATCH] InputText, Nav: fixed repeated calls to SetKeyboardFocusHere() preventing to use InputText(). (#4682) + Stack Tool: favor inspecting HoveredID over ActiveID as the later is more likely to be locked. --- docs/CHANGELOG.txt | 1 + imgui.cpp | 5 +++-- imgui.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index defb517e0..71989d1c6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -51,6 +51,7 @@ Other Changes: by the clipper to display. (#3841) - Clipper: Fixed content height declaration slightly mismatching the value of when not using a clipper. (an additional ItemSpacing.y was declared, affecting scrollbar range). +- InputText, Nav: fixed repeated calls to SetKeyboardFocusHere() preventing to use InputText(). (#4682) - Nav: pressing PageUp/PageDown/Home/End when in Menu layer automatically moves back to Main layer. - Nav: fixed resizing window from borders setting navigation to Menu layer. - Nav: pressing Esc to exit a child window reactivates the Nav highlight if it was disabled by mouse. diff --git a/imgui.cpp b/imgui.cpp index 6a527121e..98aad1ac0 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9717,8 +9717,9 @@ void ImGui::NavMoveRequestApplyResult() } } - ClearActiveID(); g.NavWindow = result->Window; + if (g.ActiveId != result->ID) + ClearActiveID(); if (g.NavId != result->ID) { // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId) @@ -12188,7 +12189,7 @@ void ImGui::UpdateDebugToolStackQueries() // Update queries. The steps are: -1: query Stack, >= 0: query each stack item // We can only perform 1 ID Info query every frame. This is designed so the GetID() tests are cheap and constant-time - const ImGuiID query_id = g.ActiveId ? g.ActiveId : g.HoveredIdPreviousFrame; + const ImGuiID query_id = g.HoveredIdPreviousFrame ? g.HoveredIdPreviousFrame : g.ActiveId; if (tool->QueryId != query_id) { tool->QueryId = query_id; diff --git a/imgui.h b/imgui.h index 4ef881059..2eda0cfa5 100644 --- a/imgui.h +++ b/imgui.h @@ -64,7 +64,7 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) #define IMGUI_VERSION "1.86 WIP" -#define IMGUI_VERSION_NUM 18506 +#define IMGUI_VERSION_NUM 18507 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE