Always pass events to ImGui to solve keyRelease issues #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR always sends keyboard events to ImGui regardless of the state of io.WantCaptureKeyboard. io.WantCaptureKeyboard is used to determine whether the keyboard event has been handled.
These changes are in line with ImGui recommendations and solve the issue of io.WantCaptureKeyboard being false after Enter is pressed (currently handled by special code in SendEventsToImGui::apply(vsg::KeyReleaseEvent& keyRelease) ). It also solves the not-yet-documented issue where the user loses control of dialogs because the Tab key constantly repeats because the Tab KeyRelease event is missed because io.WantCaptureKeyboard becomes false prematurely.
The ImGui FAQ at https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-how-can-i-tell-whether-to-dispatch-mousekeyboard-to-dear-imgui-or-my-application stresses that you should always send events to ImGui.
The PR also removes the special KeyRelease code (originally added by me) to handle Enter because it is no longer needed.
Tested on Kubuntu with VSG master libraries pulled today. Note that using Tab to navigate through dialogs also requires the following during setup
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard | ImGuiConfigFlags_NavNoCaptureKeyboard;