Skip to content

Avoid focusing default window#9243

Open
feelamee wants to merge 1 commit intoocornut:masterfrom
feelamee:fix-default-window-focus
Open

Avoid focusing default window#9243
feelamee wants to merge 1 commit intoocornut:masterfrom
feelamee:fix-default-window-focus

Conversation

@feelamee
Copy link

@feelamee feelamee commented Feb 14, 2026

Dear ImGui capture keyboard focus even if no ImGui windows was created at all.
I see this behaviour strange and undesirable.

How to reproduce:

  • use any example from examples/
  • remove all code responsible for creating windows (usually ImGui::Begin, etc)
  • rebuild
    => on app startup ImGui::GetIO().WantCaptureKeyboard == true

If required, I can create small example to reproduce.

Also, I noticed same problem in docking branch with ImGui::DockSpaceOverViewport function. If current solution acceptable I will create similar PR for docking too

@ocornut ocornut added the focus label Feb 14, 2026
@feelamee
Copy link
Author

Hm.. I researched a little and noticed that window will be created even without Begin()/End() (just using Button and others). So, my solution is incorrect here.

For me, creating default window looks like a hack, but this is usual behavior, so breaking it is not a way.

If you have any ideas how to properly handle this, I can try to implement. Else we can just move this to Issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants