|
@@ -4520,6 +4520,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
|
|
if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
|
|
|
window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
|
window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
|
|
|
|
|
|
|
|
|
+ // Apply focus, new windows appears in front
|
|
|
|
|
+ bool want_focus = false;
|
|
|
|
|
+ if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))
|
|
|
|
|
+ if (!(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
|
|
|
|
|
+ want_focus = true;
|
|
|
|
|
+
|
|
|
// Draw window + handle manual resize
|
|
// Draw window + handle manual resize
|
|
|
ImRect title_bar_rect = window->TitleBarRect();
|
|
ImRect title_bar_rect = window->TitleBarRect();
|
|
|
if (window->Collapsed)
|
|
if (window->Collapsed)
|
|
@@ -4574,7 +4580,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
|
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
|
|
|
|
|
|
|
// Title bar
|
|
// Title bar
|
|
|
- const bool window_is_focused = g.NavWindow && window->RootNonPopupWindow == g.NavWindow->RootNonPopupWindow;
|
|
|
|
|
|
|
+ const bool window_is_focused = want_focus || (g.NavWindow && window->RootNonPopupWindow == g.NavWindow->RootNonPopupWindow);
|
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
|
window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImDrawCornerFlags_Top);
|
|
window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImDrawCornerFlags_Top);
|
|
|
|
|
|
|
@@ -4661,10 +4667,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
if (window->AutoFitFramesY > 0)
|
|
if (window->AutoFitFramesY > 0)
|
|
|
window->AutoFitFramesY--;
|
|
window->AutoFitFramesY--;
|
|
|
|
|
|
|
|
- // New windows appears in front (we need to do that AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there)
|
|
|
|
|
- if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))
|
|
|
|
|
- if (!(flags & (ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
|
|
|
|
|
- FocusWindow(window);
|
|
|
|
|
|
|
+ // Apply focus (we need to call FocusWindow() AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there)
|
|
|
|
|
+ if (want_focus)
|
|
|
|
|
+ FocusWindow(window);
|
|
|
|
|
|
|
|
// Title bar
|
|
// Title bar
|
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|