Skip to content

Commit

Permalink
Inputs: fixed moving a window or drag and dropping from preventing in…
Browse files Browse the repository at this point in the history
…put-owner-unaware code from accessing keys. (#5888, #4921, #456)

Amend 4448d97. This is more consistent with input owner design.
  • Loading branch information
ocornut committed Nov 16, 2022
1 parent d60985d commit 7bee9a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)


-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down

0 comments on commit 7bee9a8

Please sign in to comment.