Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport + moved EndFrameDrawDimmedBackgrounds() call + removed duplicate code in Begin() already in EndFrameDrawDimmedBackgrounds()

This commit is contained in:
ocornut 2021-12-01 14:42:58 +01:00
parent 5f5ba8eb11
commit 1ab3007752
2 changed files with 5 additions and 18 deletions

View File

@ -151,6 +151,7 @@ Docking+Viewports Branch:
to ensure a window is not parented. Previously this would use the global default (which might be 0,
but not always as it would depend on io.ConfigViewportsNoDefaultParent). (#3152, #2871)
- Viewports: Fixed tooltip in own viewport over modal from being incorrectly dimmed. (#4729)
- Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport.
- Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (#4656)
- Disabled: Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (#4655, #4452, #4453, #4462)

View File

@ -4664,7 +4664,7 @@ static void ImGui::EndFrameDrawDimmedBackgrounds()
float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
ImRect bb = window->Rect();
bb.Expand(g.FontSize);
if (bb.Contains(window->Viewport->GetMainRect())) // If a window fits the entire viewport, adjust its highlight inward
if (!window->Viewport->GetMainRect().Contains(bb)) // If a window fits the entire viewport, adjust its highlight inward
{
bb.Expand(-g.FontSize - 1.0f);
rounding = window->WindowRounding;
@ -4704,9 +4704,6 @@ void ImGui::EndFrame()
g.CurrentWindow->Active = false;
End();
// Draw modal whitening background on _other_ viewports than the one the modal is one
EndFrameDrawDimmedBackgrounds();
// Update navigation: CTRL+Tab, wrap-around requests
NavEndFrame();
@ -4736,6 +4733,9 @@ void ImGui::EndFrame()
// Initiate moving window + handle left-click and right-click focus
UpdateMouseMovingWindowEndFrame();
// Draw modal/window whitening backgrounds
EndFrameDrawDimmedBackgrounds();
// Update user-facing viewport list (g.Viewports -> g.PlatformIO.Viewports after filtering out some)
UpdateViewportsEndFrame();
@ -6743,20 +6743,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->DrawList = &window->DrawListInst;
}
// Draw navigation selection/windowing rectangle border
if (g.NavWindowingTargetAnim == window)
{
float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
ImRect bb = window->Rect();
bb.Expand(g.FontSize);
if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward
{
bb.Expand(-g.FontSize - 1.0f);
rounding = window->WindowRounding;
}
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), rounding, 0, 3.0f);
}
// UPDATE RECTANGLES (2- THOSE AFFECTED BY SCROLLING)
// Work rectangle.