From 451c756b016ba331106ec2a4d30fc48bf7c34f6e Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 1 Aug 2019 16:23:54 -0700 Subject: [PATCH] Docking: Modals don't need to set ImGuiViewportFlags_NoFocusOnClick. This also mitigate the common described by #2445, which becomes particularly bad with unfocused modal. (#1542) --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index eaecd43b..cd077313 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6131,7 +6131,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // won't steal the OS focus away from their parent window (which may be reflected in OS the title bar decoration). // Setting _NoFocusOnClick would technically prevent us from bringing back to front in case they are being covered by an OS window from a different app, // but it shouldn't be much of a problem considering those are already popups that are closed when clicking elsewhere. - if (is_short_lived_floating_window) + if (is_short_lived_floating_window && (flags & ImGuiWindowFlags_Modal) == 0) viewport_flags |= ImGuiViewportFlags_NoFocusOnAppearing | ImGuiViewportFlags_NoFocusOnClick; // We can overwrite viewport flags using ImGuiWindowClass (advanced users)