Skip to content

Commit

Permalink
Backends: GLFW: Fixed miss untranslation of keypad keys. (#4921, #452)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Feb 1, 2022
1 parent 6f73dbe commit 4317732
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backends/imgui_impl_glfw.cpp
Expand Up @@ -282,6 +282,8 @@ static int ImGui_ImplGlfw_TranslateUntranslatedKey(int key, int scancode)
// See https://github.com/glfw/glfw/issues/1502 for details.
// Adding a workaround to undo this (so our keys are translated->untranslated->translated, likely a lossy process).
// This won't cover edge cases but this is at least going to cover common cases.
if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_EQUAL)
return key;
const char* key_name = glfwGetKeyName(key, scancode);
if (key_name && key_name[0] != 0 && key_name[1] == 0)
{
Expand Down

0 comments on commit 4317732

Please sign in to comment.