imgui: Fix char input handling

This commit is contained in:
Vojtech Kral 2019-02-20 16:55:00 +01:00
parent cb8677b310
commit 478032ad28
2 changed files with 10 additions and 7 deletions

View file

@ -5231,8 +5231,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
#if ENABLE_IMGUI
auto imgui = wxGetApp().imgui();
if (imgui->update_key_data(evt)) {
return;
render();
return;
}
#endif // ENABLE_IMGUI

View file

@ -124,6 +124,9 @@ bool ImGuiWrapper::update_key_data(wxKeyEvent &evt)
if (key != 0) {
io.AddInputCharacter(key);
}
new_frame();
return want_keyboard() || want_text_input();
} else {
// Key up/down event
int key = evt.GetKeyCode();
@ -134,7 +137,6 @@ bool ImGuiWrapper::update_key_data(wxKeyEvent &evt)
io.KeyCtrl = evt.ControlDown();
io.KeyAlt = evt.AltDown();
io.KeySuper = evt.MetaDown();
}
// XXX: Unfortunatelly this seems broken due to some interference with wxWidgets,
// we have to return true always (perform re-render).
@ -142,6 +144,7 @@ bool ImGuiWrapper::update_key_data(wxKeyEvent &evt)
// return want_keyboard() || want_text_input();
return true;
}
}
void ImGuiWrapper::new_frame()
{