Skip to content

Commit

Permalink
hack to make backspace work in ImGui
Browse files Browse the repository at this point in the history
  • Loading branch information
mlivesu committed Nov 24, 2023
1 parent beb3da9 commit 4bc4730
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion include/cinolib/gl/glcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,18 @@ void GLcanvas::key_event(GLFWwindow *window, int key, int /*scancode*/, int acti
// if visual controls claim the event, let them handle it!
if(ImGui::GetIO().WantCaptureKeyboard)
{
if(action==GLFW_RELEASE) ImGui::GetIO().AddInputCharacter(key);
if(action==GLFW_PRESS && key==GLFW_KEY_BACKSPACE)
{
ImGui::GetIO().AddKeyEvent(ImGuiKey_Backspace,true);
}
else if(action==GLFW_RELEASE)
{
switch(key)
{
case GLFW_KEY_BACKSPACE : ImGui::GetIO().AddKeyEvent(ImGuiKey_Backspace,false); break;
default : ImGui::GetIO().AddInputCharacter(key);
}
}
return;
}

Expand Down

0 comments on commit 4bc4730

Please sign in to comment.