From 7bee9a8f96a491632b35b5fade623e08ff96ea5c Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 16 Nov 2022 17:53:35 +0100 Subject: [PATCH] Inputs: fixed moving a window or drag and dropping from preventing input-owner-unaware code from accessing keys. (#5888, #4921, #456) Amend 4448d97. This is more consistent with input owner design. --- docs/CHANGELOG.txt | 4 +++- imgui.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d48152d8..80901da6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -35,7 +35,9 @@ HOW TO UPDATE? VERSION 1.89.1 (In Progress) ----------------------------------------------------------------------- - - Inputs: fix moving a window or drag and dropping from capture mods. (#5888, #4921, #456) +- Inputs: fixed moving a window or drag and dropping from preventing input-owner-unaware code + from accessing keys. (#5888, #4921, #456) +- Inputs: fixed moving a window or drag and dropping from capturing mods. (#5888, #4921, #456) ----------------------------------------------------------------------- diff --git a/imgui.cpp b/imgui.cpp index 83cfd7d8..51a1cf18 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8537,7 +8537,7 @@ ImGuiID ImGui::GetKeyOwner(ImGuiKey key) ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(key); ImGuiID owner_id = owner_data->OwnerCurr; - if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId) + if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId && owner_id != ImGuiKeyOwner_Any) if (key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END) return ImGuiKeyOwner_None; @@ -8554,7 +8554,7 @@ bool ImGui::TestKeyOwner(ImGuiKey key, ImGuiID owner_id) return true; ImGuiContext& g = *GImGui; - if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId) + if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId && owner_id != ImGuiKeyOwner_Any) if (key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END) return false;