Skip to content

Commit

Permalink
When untranslated key has not mapping fallback to KeyMap
Browse files Browse the repository at this point in the history
  • Loading branch information
thedmd committed Apr 19, 2020
1 parent 91cada9 commit eae4f28
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4379,9 +4379,13 @@ int ImGui::GetUntranslatedKeyIndex(ImGuiKey imgui_key)
ImGuiContext& g = *GImGui;

if (g.IO.BackendFlags & ImGuiBackednFlags_HasUntranslatedKeys)
return g.IO.ScancodeMap[imgui_key];
else
return g.IO.KeyMap[imgui_key];
{
int key_index = g.IO.ScancodeMap[imgui_key];
if (key_index >= 0)
return key_index;
}

return g.IO.KeyMap[imgui_key];
}

// Note that dear imgui doesn't know the semantic of each entry of io.KeysDown[]!
Expand Down

0 comments on commit eae4f28

Please sign in to comment.