From 6f171a066d64a15f43b69423329391c84bf49754 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 28 Nov 2023 14:28:19 +0100 Subject: [PATCH] Nav, IO: SetNextFrameWantCaptureKeyboard(false) calls are not overrided back to true when navigation is enabled. (#6997) --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 0c945fe82..85c8ea9bc 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -46,6 +46,8 @@ Other changes: - Windows: BeginChild(): Fixed auto-resizing erroneously limiting size to host viewport 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 (namely Selectables and Treenodes using SpanAllColumn flag) so the highlight properly covers all columns. (#7049, #4281, #3272) diff --git a/imgui.cpp b/imgui.cpp index 34002831d..12ae9139e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -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) - if (g.WantCaptureKeyboardNextFrame != -1) - io.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0); - else - io.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL); + io.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL); if (io.NavActive && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard)) 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 io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;