diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp index 1713bd5c..f8cbe7d9 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp @@ -128,10 +128,10 @@ void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow*, int key, int, int action, int mo io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT]; } -void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow*, unsigned int c) +void ImGui_ImplGlfwGL3_CharModsCallback(GLFWwindow*, unsigned int c, int mods) { ImGuiIO& io = ImGui::GetIO(); - if (c > 0 && c < 0x10000) + if ((mods & ~GLFW_MOD_SHIFT) == 0 && c > 0 && c < 0x10000) io.AddInputCharacter((unsigned short)c); } @@ -262,7 +262,7 @@ bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks) glfwSetMouseButtonCallback(window, ImGui_ImplGlfwGL3_MouseButtonCallback); glfwSetScrollCallback(window, ImGui_ImplGlfwGL3_ScrollCallback); glfwSetKeyCallback(window, ImGui_ImplGlfwGL3_KeyCallback); - glfwSetCharCallback(window, ImGui_ImplGlfwGL3_CharCallback); + glfwSetCharModsCallback(window, ImGui_ImplGlfwGL3_CharModsCallback); } return true; diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.h b/examples/opengl3_example/imgui_impl_glfw_gl3.h index 81b59528..caad6646 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.h +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.h @@ -17,4 +17,4 @@ bool ImGui_ImplGlfwGL3_CreateDeviceObjects(); void ImGui_ImplGlfwGL3_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); void ImGui_ImplGlfwGL3_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); -void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow* window, unsigned int c); +void ImGui_ImplGlfwGL3_CharModsCallback(GLFWwindow* window, unsigned int c, int mods); diff --git a/examples/opengl_example/imgui_impl_glfw.cpp b/examples/opengl_example/imgui_impl_glfw.cpp index 331c7776..1fbb410d 100644 --- a/examples/opengl_example/imgui_impl_glfw.cpp +++ b/examples/opengl_example/imgui_impl_glfw.cpp @@ -127,10 +127,10 @@ void ImGui_ImplGlFw_KeyCallback(GLFWwindow*, int key, int, int action, int mods) io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT]; } -void ImGui_ImplGlfw_CharCallback(GLFWwindow*, unsigned int c) +void ImGui_ImplGlfw_CharModsCallback(GLFWwindow*, unsigned int c, int mods) { ImGuiIO& io = ImGui::GetIO(); - if (c > 0 && c < 0x10000) + if ((mods & ~GLFW_MOD_SHIFT) == 0 && c > 0 && c < 0x10000) io.AddInputCharacter((unsigned short)c); } @@ -207,7 +207,7 @@ bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks) glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback); glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback); glfwSetKeyCallback(window, ImGui_ImplGlFw_KeyCallback); - glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback); + glfwSetCharModsCallback(window, ImGui_ImplGlfw_CharModsCallback); } return true; diff --git a/examples/opengl_example/imgui_impl_glfw.h b/examples/opengl_example/imgui_impl_glfw.h index 502d837f..e4fea733 100644 --- a/examples/opengl_example/imgui_impl_glfw.h +++ b/examples/opengl_example/imgui_impl_glfw.h @@ -17,4 +17,4 @@ bool ImGui_ImplGlfw_CreateDeviceObjects(); void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); void ImGui_ImplGlFw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); -void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); +void ImGui_ImplGlfw_CharModsCallback(GLFWwindow* window, unsigned int c, int mods);