Skip to content
/ imgui Public
forked from ocornut/imgui

Commit

Permalink
enable viewport window background alpha and rounding
Browse files Browse the repository at this point in the history
Temporary patch until ocornut/imgui ocornut#2766 is merged.
  • Loading branch information
cfillion committed Apr 25, 2022
1 parent 1ee2527 commit 0035fd1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6058,8 +6058,6 @@ 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);
if (is_docking_transparent_payload)
window->Viewport->Alpha *= DOCKING_TRANSPARENT_PAYLOAD_ALPHA;
}
Expand Down Expand Up @@ -6726,7 +6724,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)

// Lock window rounding for the frame (so that altering them doesn't cause inconsistencies)
// Large values tend to lead to variety of artifacts and are not recommended.
if (window->ViewportOwned || window->DockIsActive)
if (window->DockIsActive)
window->WindowRounding = 0.0f;
else
window->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding;
Expand Down Expand Up @@ -13158,8 +13156,8 @@ void ImGui::WindowSyncOwnedViewport(ImGuiWindow* window, ImGuiWindow* parent_win
// We can also tell the backend that clearing the platform window won't be necessary,
// as our window background is filling the viewport and we have disabled BgAlpha.
// FIXME: Work on support for per-viewport transparency (#2766)
if (!(window_flags & ImGuiWindowFlags_NoBackground))
viewport_flags |= ImGuiViewportFlags_NoRendererClear;
// if (!(window_flags & ImGuiWindowFlags_NoBackground) && window->WindowRounding == 0.0f)
// viewport_flags |= ImGuiViewportFlags_NoRendererClear;

window->Viewport->Flags = viewport_flags;

Expand Down

0 comments on commit 0035fd1

Please sign in to comment.