1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-08 23:44:19 +00:00

InputText, Nav: fixed remote/shortcut InputText() not teleporting mouse cursor when nav cursor is active and io.ConfigNavMoveSetMousePos is enabled.

Motivated by this, also made SetFocusID() immediately set g.NavIdIsAlive, which is more correct and might be other (positive) subtle side effects.
This commit is contained in:
ocornut 2026-01-08 17:04:52 +01:00
parent 3389dfd9dd
commit 1566c96ccd
3 changed files with 7 additions and 0 deletions

View file

@ -150,6 +150,9 @@ Other Changes:
end of a line rather than at the beginning of next line. (#8990, #3237)
- Fixed low-level word-wrapping function reading from *text_end when passed
a string range. (#9107) [@achabense]
- Nav:
- Fixed remote/shortcut InputText() not teleporting mouse cursor when
nav cursor is visible and `io.ConfigNavMoveSetMousePos` is enabled.
- Scrollbar: fixed a codepath leading to a divide-by-zero (which would not be
noticeable by user but detected by sanitizers). (#9089) [@judicaelclair]
- Added GetItemFlags() in public API for consistency and to expose generic

View file

@ -13055,6 +13055,8 @@ void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
window->NavLastIds[nav_layer] = id;
if (g.LastItemData.ID == id)
window->NavRectRel[nav_layer] = WindowRectAbsToRel(window, g.LastItemData.NavRect);
if (g.NavId == g.ActiveId && g.ActiveIdIsAlive)
g.NavIdIsAlive = true;
if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad)
g.NavHighlightItemUnderNav = true;

View file

@ -4848,6 +4848,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
SetActiveID(id, window);
SetFocusID(id, window);
FocusWindow(window);
if (input_requested_by_nav)
SetNavCursorVisibleAfterMove();
}
if (g.ActiveId == id)
{