Skip to content

SDL/GLFW text input events reported to both keyPressEvent() and textInputEvent() #41

Open
@Getshi

Description

@Getshi

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 the DragFloat value but the event is still being processed by the magnum application as well.

More specifically:

void MyApplication::keyPressEvent(KeyEvent &event) {
  if (m_imgui.handleKeyPressEvent(event))
    return;

  switch (event.key()) {
  case KeyEvent::Key::One:
    // DO SOMETHING
    break;
[...]

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 the DragFloat text field is active, no key event would be processed by magnum.

Or am I simply missing some line of code?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Important TODO

Status

TODO

Relationships

None yet

Development

No branches or pull requests

Issue actions