Conversation
|
Hm.. I researched a little and noticed that window will be created even without 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. |
|
How about calling |
|
hm.. as a workaround it almost work. Probably from the client side the simplest solution would be to wrap
|
I don't understand what you mean, please clarify.
The implicit "Debug" window is always submitted. |
With such code // somewhere before main loop
bool show_demo_window = false;
bool is_first_frame = true;
// in main loop
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL3_NewFrame();
ImGui::NewFrame();
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
if (is_first_frame)
{
ImGui::SetWindowFocus(nullptr);
is_first_frame = false;
}
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}After starting:
=> it's correct But now, if I set init value of
=> So, workaround with |
I tried this and it doesn't happen for it. When I close the Demo Window focus is cleared correctly. if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
if (is_first_frame)
{
ImGui::SetWindowFocus(nullptr);
is_first_frame = false;
}
IMGUI_DEBUG_LOG("io.WantCaptureKeyboard %d\n", io.WantCaptureKeyboard); |
|
It's actually on for one frame, but I don't think that's a problem? [00248] io.WantCaptureKeyboard 1, focused 'Dear ImGui Demo' // Closing Demo
[00249] io.WantCaptureKeyboard 1, focused 'NULL' // <--- on for one frame
[00250] io.WantCaptureKeyboard 0, focused 'NULL'
[00251] io.WantCaptureKeyboard 0, focused 'NULL' |
…ting io.WantCaptureKeyboard for a frame. (#9243)
|
I am pushing 1fbab15 for correctness but it seems like there's something else happening with you. Can you (1) confirm IMGUI_VERSION_NUM value? (2) do you have multiple viewports, and where is the Debug window (you can double-check in .ini data) ? As an alternative to work with e.g. DockspaceOverViewport() I believe its code could be changed as well: -- if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode)
-- host_window_flags |= ImGuiWindowFlags_NoBackground;
++ if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode)
++ host_window_flags |= ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoFocusOnAppearing;Can you test with both 1fbab15 + this suggested change? |
19260
no,
So, I remoed But, this problem resist - after closing last window ImGui still capture keyboard focus.
Sure, sorry. Add call to |
Dear ImGui capture keyboard focus even if no ImGui windows was created at all.
I see this behaviour strange and undesirable.
How to reproduce:
ImGui::Begin, etc)=> on app startup
ImGui::GetIO().WantCaptureKeyboard == trueIf required, I can create small example to reproduce.
Also, I noticed same problem in docking branch with
ImGui::DockSpaceOverViewportfunction. If current solution acceptable I will create similar PR for docking too