-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Focused window pushed into the background by tooltips of other windows #7354
Comments
I investigated this and it appears caused by the fact that a child-parent relationship at the HWND level (honored by imgui_impl_win32) raise the parent along with the child. in ImGui_ImplWin32_CreateWindow: vd->HwndParent = ImGui_ImplWin32_GetHwndFromViewportID(viewport->ParentViewportId);
[...]
vd->Hwnd = ::CreateWindowEx(....., ....., ....., vd->HwndParent); // this will raise vd->HwndParent as well At dear imgui level, this is triggered by code in else if ((window_flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && parent_window_in_stack && (!parent_window_in_stack->IsFallbackWindow || parent_window_in_stack->WasActive))
window->Viewport->ParentViewportId = parent_window_in_stack->Viewport->ID;
else
window->Viewport->ParentViewportId = g.IO.ConfigViewportsNoDefaultParent ? 0 : IMGUI_VIEWPORT_DEFAULT_ID; If you remove The commits are mostly 3ead982 (code moved in cce307a) and they were in reaction to #2409 which incidentally is to fix a similar bug with the other viewport. I don't know what would be a good solution for now. |
…sn't bring its parent viewport to front. (#7354)
This was incorrect: Temporarily clearing I confirmed that it didn't interfere with the fact that later clicking that child window (in the case of a non-tooltp) will raise the window. I believe this is actually quite a good/desirable improvement. Thanks! |
Thank you for the quick fix. |
Version/Branch of Dear ImGui:
Version 1.90.4 WIP, Branch: docking
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11/dx12.cpp
Compiler, OS:
Windows 10/11 + MSVC 2019/2022
Full config/build information:
Details:
By adding detailed tooltips for some tool windows I noticed some strange viewport behavior. As soon as a tooltip in a background window leaves the boundary if that window's viewport, the tooltip gets its own viewport and messes with the window order. A foreground window then gets pushed into the background while staying focused. To get it into the foreground again, it must first be unfocused, then focused again. I added exact instructions to the example code.
The focused window getting pushed into the background is the main issue. It staying focused is expected (if it were staying in the foreground that is).
A workaround in my application would be to display tooltips only for focused windows, but having the information just by hovering would be better.
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: