Nav, IO: SetNextFrameWantCaptureKeyboard(false) calls are not overrided back to true when navigation is enabled. (#6997)

This commit is contained in:
ocornut 2023-11-28 14:28:19 +01:00
parent 1f3090a48d
commit 6f171a066d
2 changed files with 5 additions and 4 deletions

View File

@ -46,6 +46,8 @@ Other changes:
- Windows: BeginChild(): Fixed auto-resizing erroneously limiting size to host viewport - Windows: BeginChild(): Fixed auto-resizing erroneously limiting size to host viewport
minus padding. There are no limit to a child width/height. (#7063) [@Devyre] minus padding. There are no limit to a child width/height. (#7063) [@Devyre]
- Nav, IO: SetNextFrameWantCaptureKeyboard(false) calls are not overrided back to true when
navigation is enabled. SetNextFrameWantCaptureKeyboard() is always higher priority. (#6997)
- Drag and Drop: Fixed drop target highlight on items temporarily pushing a widened clip rect - Drag and Drop: Fixed drop target highlight on items temporarily pushing a widened clip rect
(namely Selectables and Treenodes using SpanAllColumn flag) so the highlight properly covers (namely Selectables and Treenodes using SpanAllColumn flag) so the highlight properly covers
all columns. (#7049, #4281, #3272) all columns. (#7049, #4281, #3272)

View File

@ -4566,12 +4566,11 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags()
} }
// Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app) // Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app)
if (g.WantCaptureKeyboardNextFrame != -1) io.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL);
io.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0);
else
io.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL);
if (io.NavActive && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard)) if (io.NavActive && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard))
io.WantCaptureKeyboard = true; io.WantCaptureKeyboard = true;
if (g.WantCaptureKeyboardNextFrame != -1) // Manual override
io.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0);
// Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible // Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible
io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false; io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;