mirror of
https://github.com/ocornut/imgui.git
synced 2026-05-28 20:26:06 +08:00
Nav: fixed navigation cursor briefly appearing when using API to focus an InputText() in a window with _NoNavInputs flag. (#9214)
build / Build - Windows (push) Has been cancelled
build / Build - Linux (push) Has been cancelled
build / Build - MacOS (push) Has been cancelled
build / Build - iOS (push) Has been cancelled
build / Build - Emscripten (push) Has been cancelled
build / Build - Android (push) Has been cancelled
build / Test - Windows (push) Has been cancelled
build / Test - Linux (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled
build / Build - Windows (push) Has been cancelled
build / Build - Linux (push) Has been cancelled
build / Build - MacOS (push) Has been cancelled
build / Build - iOS (push) Has been cancelled
build / Build - Emscripten (push) Has been cancelled
build / Build - Android (push) Has been cancelled
build / Test - Windows (push) Has been cancelled
build / Test - Linux (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled
Amend 1566c96cc
This commit is contained in:
@@ -3972,6 +3972,9 @@ void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFl
|
|||||||
return;
|
return;
|
||||||
if (id == g.LastItemData.ID && (g.LastItemData.ItemFlags & ImGuiItemFlags_NoNav))
|
if (id == g.LastItemData.ID && (g.LastItemData.ItemFlags & ImGuiItemFlags_NoNav))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// We don't early out on 'window->Flags & ImGuiWindowFlags_NoNavInputs' because it would be inconsistent with
|
||||||
|
// other code directly checking NavCursorVisible. Instead we aim for NavCursorVisible to always be false.
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (window->DC.NavHideHighlightOneFrame)
|
if (window->DC.NavHideHighlightOneFrame)
|
||||||
return;
|
return;
|
||||||
@@ -12953,7 +12956,9 @@ void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWind
|
|||||||
void ImGui::SetNavCursorVisible(bool visible)
|
void ImGui::SetNavCursorVisible(bool visible)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.IO.ConfigNavCursorVisibleAlways)
|
if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||||
|
visible = false;
|
||||||
|
else if (g.IO.ConfigNavCursorVisibleAlways)
|
||||||
visible = true;
|
visible = true;
|
||||||
g.NavCursorVisible = visible;
|
g.NavCursorVisible = visible;
|
||||||
}
|
}
|
||||||
@@ -12962,7 +12967,9 @@ void ImGui::SetNavCursorVisible(bool visible)
|
|||||||
void ImGui::SetNavCursorVisibleAfterMove()
|
void ImGui::SetNavCursorVisibleAfterMove()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.IO.ConfigNavCursorVisibleAuto)
|
if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||||
|
g.NavCursorVisible = false;
|
||||||
|
else if (g.IO.ConfigNavCursorVisibleAuto)
|
||||||
g.NavCursorVisible = true;
|
g.NavCursorVisible = true;
|
||||||
g.NavHighlightItemUnderNav = g.NavMousePosDirty = true;
|
g.NavHighlightItemUnderNav = g.NavMousePosDirty = true;
|
||||||
}
|
}
|
||||||
@@ -13906,7 +13913,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||||||
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "<NULL>", g.NavLayer);
|
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "<NULL>", g.NavLayer);
|
||||||
g.NavInitRequest = g.NavInitRequestFromMove = true;
|
g.NavInitRequest = g.NavInitRequestFromMove = true;
|
||||||
g.NavInitResult.ID = 0;
|
g.NavInitResult.ID = 0;
|
||||||
if (g.IO.ConfigNavCursorVisibleAuto)
|
if (g.IO.ConfigNavCursorVisibleAuto) // NO check for _NoNavInputs here as we assume MoveRequests cannot be created.
|
||||||
g.NavCursorVisible = true;
|
g.NavCursorVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user