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()
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 54d79fc..682bd01 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -151,6 +151,7 @@
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)
diff --git a/imgui.cpp b/imgui.cpp
index adc4d6b..fd1e563 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -4664,7 +4664,7 @@
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 @@
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 @@
// 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 @@
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.