From 478032ad28b35d0290790a12da68d73bdbd31be0 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Wed, 20 Feb 2019 16:55:00 +0100 Subject: [PATCH] imgui: Fix char input handling --- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/ImGuiWrapper.cpp | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 3c47e2c26..ee7425de2 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -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 diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index d8d8089c2..0ec0050e6 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -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,13 +137,13 @@ 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). - // new_frame(); - // return want_keyboard() || want_text_input(); - return true; + // XXX: Unfortunatelly this seems broken due to some interference with wxWidgets, + // we have to return true always (perform re-render). + // new_frame(); + // return want_keyboard() || want_text_input(); + return true; + } } void ImGuiWrapper::new_frame()