Version/Branch of Dear ImGui:
Version: 1.87 WIP
Branch: docking acfc779 (Latest as of today)
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: MSVC 19.31.30919 (Visual Studio 2022 17.1.0p2)
Operating System: Windows 10 21H2
My Issue/Question:
Pressing Alt+PrintScreen causes this assert to fail:
|
IM_ASSERT(ImGui::IsNamedKey(key)); // >= 512 |
This is happening because this key combination results in ImGui_ImplGlfw_KeyCallback being called with keycode = -1, scancode = 84, action = 1, mods = 4.
The -1 keycode causes ImGui_ImplGlfw_KeyToImGuiKey to return ImGuiKey_None which is then passed to SetKeyEventNativeData:
|
ImGuiKey imgui_key = ImGui_ImplGlfw_KeyToImGuiKey(keycode); |
|
io.AddKeyEvent(imgui_key, (action == GLFW_PRESS)); |
|
io.SetKeyEventNativeData(imgui_key, keycode, scancode); // To support legacy indexing (<1.87 user code) |
I haven't had time to dig into the new input queue stuff so it's not totally clear to me whether SetKeyEventNativeData should be tolerant of ImGuiKey_None or if the GLFW backend shouldn't be calling it in the first place in this situation.
Screenshots/Video
Not applicable.
Standalone, minimal, complete and verifiable example:
This bug reproduces in example_glfw_opengl3 without modification.
Version/Branch of Dear ImGui:
Version: 1.87 WIP
Branch: docking acfc779 (Latest as of today)
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: MSVC 19.31.30919 (Visual Studio 2022 17.1.0p2)
Operating System: Windows 10 21H2
My Issue/Question:
Pressing
Alt+PrintScreencauses this assert to fail:imgui/imgui.cpp
Line 1305 in acfc779
This is happening because this key combination results in
ImGui_ImplGlfw_KeyCallbackbeing called withkeycode = -1, scancode = 84, action = 1, mods = 4.The -1
keycodecausesImGui_ImplGlfw_KeyToImGuiKeyto returnImGuiKey_Nonewhich is then passed toSetKeyEventNativeData:imgui/backends/imgui_impl_glfw.cpp
Lines 324 to 326 in acfc779
I haven't had time to dig into the new input queue stuff so it's not totally clear to me whether
SetKeyEventNativeDatashould be tolerant ofImGuiKey_Noneor if the GLFW backend shouldn't be calling it in the first place in this situation.Screenshots/Video
Not applicable.
Standalone, minimal, complete and verifiable example:
This bug reproduces in
example_glfw_opengl3without modification.