Viewport: Fixed collapsed windows setting ImGuiViewportFlags_NoRendererClear without making title bar color opaque.

(thanks christopher knorr!)
This commit is contained in:
ocornut 2022-11-18 19:34:24 +01:00
parent 38cfe22b8b
commit 9964740a47
2 changed files with 11 additions and 3 deletions

View File

@ -106,6 +106,13 @@ Other changes:
from accessing keys. (#5888, #4921, #456)
- Inputs: fixed moving a window or drag and dropping from capturing mods. (#5888, #4921, #456)
Docking+Viewports Branch:
- Viewport: Fixed collapsed windows setting ImGuiViewportFlags_NoRendererClear without
making title bar color opaque, leading to potential texture/fb garbage being visible.
Right now as we don't fully support transparent viewports (#2766), so we turn that
'TitleBgCollapsed' color opaque just lke we do for 'WindowBG' on uncollapsed windows.
-----------------------------------------------------------------------
VERSION 1.89 (Released 2022-11-15)

View File

@ -6388,9 +6388,11 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
if (window->Collapsed)
{
// Title bar only
float backup_border_size = style.FrameBorderSize;
const float backup_border_size = style.FrameBorderSize;
g.Style.FrameBorderSize = window->WindowBorderSize;
ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
if (window->ViewportOwned)
title_bar_col |= IM_COL32_A_MASK; // No alpha (we don't support is_docking_transparent_payload here because simpler and less meaningful, but could with a bit of code shuffle/reuse)
RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
g.Style.FrameBorderSize = backup_border_size;
}
@ -6407,8 +6409,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
ImU32 bg_col = GetColorU32(GetWindowBgColorIdx(window));
if (window->ViewportOwned)
{
// No alpha
bg_col = (bg_col | IM_COL32_A_MASK);
bg_col |= IM_COL32_A_MASK; // No alpha
if (is_docking_transparent_payload)
window->Viewport->Alpha *= DOCKING_TRANSPARENT_PAYLOAD_ALPHA;
}