|
@@ -4803,8 +4803,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- // Window background, Default Alpha
|
|
|
+ // Window background
|
|
|
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
|
|
+ if (g.NextWindowData.BgAlphaCond != 0)
|
|
|
+ bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(g.NextWindowData.BgAlphaVal) << IM_COL32_A_SHIFT);
|
|
|
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
|
|
|
|
|
// Title bar
|
|
@@ -5010,22 +5012,12 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
|
|
{
|
|
|
// Old API feature: we could pass the initial window size as a parameter, however this was very misleading because in most cases it would only affect the window when it didn't have storage in the .ini file.
|
|
|
if (size_on_first_use.x != 0.0f || size_on_first_use.y != 0.0f)
|
|
|
- SetNextWindowSize(size_on_first_use, ImGuiCond_FirstUseEver);
|
|
|
+ ImGui::SetNextWindowSize(size_on_first_use, ImGuiCond_FirstUseEver);
|
|
|
|
|
|
- // Old API feature: we could override the window background alpha with a parameter. This is actually tricky to reproduce manually because:
|
|
|
- // (1) there are multiple variants of WindowBg (popup, tooltip, etc.) and (2) you can't call PushStyleColor before Begin and PopStyleColor just after Begin() because of how CheckStackSizes() behave.
|
|
|
- // The user-side solution is to do backup = GetStyleColorVec4(ImGuiCol_xxxBG), PushStyleColor(ImGuiCol_xxxBg), Begin, PushStyleColor(ImGuiCol_xxxBg, backup), [...], PopStyleColor(), End(); PopStyleColor() - which is super awkward.
|
|
|
- // The alpha override was rarely used but for now we'll leave the Begin() variant around for a bit. We may either lift the constraint on CheckStackSizes() either add a SetNextWindowBgAlpha() helper that does it magically.
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
- const ImGuiCol bg_color_idx = GetWindowBgColorIdxFromFlags(flags);
|
|
|
- const ImVec4 bg_color_backup = g.Style.Colors[bg_color_idx];
|
|
|
- if (bg_alpha_override >= 0.0f)
|
|
|
- g.Style.Colors[bg_color_idx].w = bg_alpha_override;
|
|
|
-
|
|
|
- bool ret = Begin(name, p_open, flags);
|
|
|
+ // Old API feature: override the window background alpha with a parameter.
|
|
|
+ ImGui::SetNextWindowBgAlpha(bg_alpha_override);
|
|
|
|
|
|
- if (bg_alpha_override >= 0.0f)
|
|
|
- g.Style.Colors[bg_color_idx] = bg_color_backup;
|
|
|
+ bool ret = ImGui::Begin(name, p_open, flags);
|
|
|
return ret;
|
|
|
}
|
|
|
#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
@@ -5803,7 +5795,14 @@ void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond)
|
|
|
void ImGui::SetNextWindowFocus()
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- g.NextWindowData.FocusCond = ImGuiCond_Always;
|
|
|
+ g.NextWindowData.FocusCond = ImGuiCond_Always; // Using a Cond member for consistency (may transition all of them to single flag set for fast Clear() op)
|
|
|
+}
|
|
|
+
|
|
|
+void ImGui::SetNextWindowBgAlpha(float alpha)
|
|
|
+{
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ g.NextWindowData.BgAlphaVal = alpha;
|
|
|
+ g.NextWindowData.BgAlphaCond = ImGuiCond_Always; // Using a Cond member for consistency (may transition all of them to single flag set for fast Clear() op)
|
|
|
}
|
|
|
|
|
|
// In window space (not screen space!)
|