Viewport: Fixed CTRL+TAB windowing list displaying too many dimming layers (fix dd61c48 for viewport branch)

This commit is contained in:
omar 2018-07-12 11:19:17 +02:00
parent 88df66ec83
commit d107146687

View File

@ -7405,16 +7405,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
else else
PushClipRect(viewport_rect.Min, viewport_rect.Max, true); PushClipRect(viewport_rect.Min, viewport_rect.Max, true);
// Draw modal window background (darkens what is behind them, all viewports) // Draw modal or window list full viewport dimming background (for other viewports we'll render them in EndFrame)
const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetFrontMostPopupModal() && window->HiddenFrames <= 0; const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetFrontMostPopupModal() && window->HiddenFrames <= 0;
const bool dim_bg_for_window_list = g.NavWindowingTarget && ((window == g.NavWindowingTarget->RootWindow) || (g.NavWindowingList && (window == g.NavWindowingList) && g.NavWindowingList->Viewport != g.NavWindowingTarget->Viewport)); const bool dim_bg_for_window_list = g.NavWindowingTarget && ((window == g.NavWindowingTarget->RootWindow) || (g.NavWindowingList && (window == g.NavWindowingList) && g.NavWindowingList->Viewport != g.NavWindowingTarget->Viewport));
if (dim_bg_for_modal || dim_bg_for_window_list) if (dim_bg_for_modal || dim_bg_for_window_list)
for (int viewport_n = 0; viewport_n < g.Viewports.Size; viewport_n++)
{ {
ImGuiViewportP* viewport = g.Viewports[viewport_n];
ImDrawList* draw_list = (viewport == window->Viewport) ? window->DrawList : GetOverlayDrawList(viewport);
const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio); const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio);
draw_list->AddRectFilled(viewport->Pos, viewport->Pos + viewport->Size, dim_bg_col); window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col);
} }
// Draw navigation selection/windowing rectangle background // Draw navigation selection/windowing rectangle background