Nav: Fixed pressing Escape to leave menu layer while in a popup or child window. (#787)

This commit is contained in:
ocornut 2021-04-23 19:08:22 +02:00
parent 21428ad3f4
commit b493cae8c9
3 changed files with 9 additions and 8 deletions

View File

@ -43,9 +43,10 @@ Other Changes:
- Scrolling: Fix scroll snapping on edge of scroll region when both scrollbars are enabled. - Scrolling: Fix scroll snapping on edge of scroll region when both scrollbars are enabled.
- Scrolling: Fix mouse wheel axis swap when using SHIFT on macOS (system already does it). (#4010) - Scrolling: Fix mouse wheel axis swap when using SHIFT on macOS (system already does it). (#4010)
- Window: Fix IsWindowAppearing() from returning true twice in most cases. (#3982, #1497, #1061) - Window: Fix IsWindowAppearing() from returning true twice in most cases. (#3982, #1497, #1061)
- Nav: Fixed using SetItemDefaultFocus() on windows with _NavFlattened flag. - Nav: Fixed toggling menu layer while an InputText() is active not stealing active id. (#787)
- Nav: Fixed toggling menu layer while an InputText() is active not stealing active id. - Nav: Fixed pressing Escape to leave menu layer while in a popup or child window. (#787)
- Nav, InputText: Fixed accidental menu toggling while typing non-ascii characters using AltGR. [@rokups] (#370) - Nav, InputText: Fixed accidental menu toggling while typing non-ascii characters using AltGR. [@rokups] (#370)
- Nav: Fixed using SetItemDefaultFocus() on windows with _NavFlattened flag. (#787)
- Tables: Expose TableSetColumnEnabled() in public api. (#3935) - Tables: Expose TableSetColumnEnabled() in public api. (#3935)
- Tables: Better preserve widths when columns count changes. (#4046) - Tables: Better preserve widths when columns count changes. (#4046)
- TabBar: Fixed mouse reordering with very fast movements (e.g. crossing multiple tabs in a single - TabBar: Fixed mouse reordering with very fast movements (e.g. crossing multiple tabs in a single

View File

@ -9114,6 +9114,11 @@ static void ImGui::NavUpdate()
if (!IsActiveIdUsingNavInput(ImGuiNavInput_Cancel)) if (!IsActiveIdUsingNavInput(ImGuiNavInput_Cancel))
ClearActiveID(); ClearActiveID();
} }
else if (g.NavLayer != ImGuiNavLayer_Main)
{
// Leave the "menu" layer
NavRestoreLayer(ImGuiNavLayer_Main);
}
else if (g.NavWindow && g.NavWindow != g.NavWindow->RootWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->ParentWindow) else if (g.NavWindow && g.NavWindow != g.NavWindow->RootWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->ParentWindow)
{ {
// Exit child window // Exit child window
@ -9130,11 +9135,6 @@ static void ImGui::NavUpdate()
if (!(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) if (!(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal))
ClosePopupToLevel(g.OpenPopupStack.Size - 1, true); ClosePopupToLevel(g.OpenPopupStack.Size - 1, true);
} }
else if (g.NavLayer != ImGuiNavLayer_Main)
{
// Leave the "menu" layer
NavRestoreLayer(ImGuiNavLayer_Main);
}
else else
{ {
// Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were // Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were

View File

@ -61,7 +61,7 @@ Index of this file:
// Version // 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) // (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.83 WIP" #define IMGUI_VERSION "1.83 WIP"
#define IMGUI_VERSION_NUM 18205 #define IMGUI_VERSION_NUM 18206
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE