-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL/GLFW text input events reported to both keyPressEvent() and textInputEvent() #41
Comments
Hi! coincidentally, we were discussing this exact issue yesterday on the Gitter channel. The problem is that, for text input, SDL2 and GLFW fire both If you scroll through the channel archives in the above link, an ImGui-specific workaround involves checking A proper fix needs to be done on the |
So
seems to be working fine, thanks for the quick suggestion! I've left out the Is there any reason this solution is just a temporary fix? Otherwise this could just be done automatically by |
If I'm not mistaken, the above is doing the same as this: if (m_imgui.handleKeyPressEvent(event) || isTextInputActive())
return; This in practice means, if any text input widget is active, it disallows handling of any key press events. For example, that would mean Ctrl S to trigger a file save would not be working if a text area is focused. Or F1 to open a help. Etc. So while the above works for you (and for majority of other users as well), the proper fix is to suppress the key press event only if it really produces some text input. And that's a thing I currently don't know how to handle portably -- it needs to take into account dead keys (diacritics), Unicode, IME etc. |
Good to know, thanks for the explanation! |
Hi!
I have set some numeric hotkeys in my magnum application, but now whenever I type numeric input into the text field of e.g. a
DragFloat
, then I can edit theDragFloat
value but the event is still being processed by the magnum application as well.More specifically:
handleKeyPressEvent
does not return true for numeric input.Actually, it does not return true when typing anything (e.g. "r") in the
DragFloat
text field; however, "r" is not being written into the text field, so one might argue that imgui ignores this event so magnum can process it, though I'm not sure if I wouldn't prefer if as long as theDragFloat
text field is active, no key event would be processed by magnum.Or am I simply missing some line of code?
The text was updated successfully, but these errors were encountered: