Skip to content

Conversation

@gaborpapp
Copy link
Contributor

When an ImGui window has focus, all keyboard events are blocked from reaching the application, preventing other keyboard shortcuts handled in the app keyDown from working. This occurs because keyboard navigation is enabled by default, causing ImGui to capture all keyboard input for navigation purposes.

The proposed fix with the NavNoCaptureKeyboard flag prevents ImGui from setting WantCaptureKeyboard=true when only navigation is active (not text input). This allows the event handlers to correctly propagate keyboard events to the application when ImGui doesn't actually need them for text input.

@andrewfb
Copy link
Collaborator

Thanks for this, Gabor. This sounds promising but I was having trouble testing it meaning, I didn't see the behavior change I'd expect. Do you mind walking me through how to test it?

@gaborpapp
Copy link
Contributor Author

I usually have Escape quitting the application:

void CinderApp::keyDown( KeyEvent event )
{   
    switch ( event.getCode() )
    {
        case KeyEvent::KEY_ESCAPE:
            quit();
            break;
    }
} 

Without this change, if the ImGui window is in focus Esc does not do anything. I mainly tested it on Linux and Mac, though.

@andrewfb andrewfb merged commit 1196bfd into cinder:master Sep 5, 2025
2 of 8 checks passed
@andrewfb
Copy link
Collaborator

andrewfb commented Sep 5, 2025

Thanks for this - I tested it locally on both Linux and Windows. I don't believe MSW behavior changed, but the fix was apparent with Linux.

@gaborpapp gaborpapp deleted the imgui-keyboard-event-propagation branch October 21, 2025 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants