Internals: Renamed GetFrontMostModalRootWindow() to GetFrontMostPopupModal() and exposed in imgui_internal.h (#1738)
diff --git a/imgui.cpp b/imgui.cpp
index 7b1fc22..c229391 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -741,7 +741,6 @@
static ImRect GetViewportRect();
static void ClosePopupToLevel(int remaining);
-static ImGuiWindow* GetFrontMostModalRootWindow();
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
@@ -3354,7 +3353,7 @@
g.HoveredRootWindow = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL;
// Modal windows prevents cursor from hovering behind them.
- ImGuiWindow* modal_window = GetFrontMostModalRootWindow();
+ ImGuiWindow* modal_window = GetFrontMostPopupModal();
if (modal_window)
if (g.HoveredRootWindow && !IsWindowChildOf(g.HoveredRootWindow, modal_window))
g.HoveredRootWindow = g.HoveredWindow = NULL;
@@ -3505,7 +3504,7 @@
NewFrameUpdateMovingWindow();
NewFrameUpdateHoveredWindowAndCaptureFlags();
- if (GetFrontMostModalRootWindow() != NULL)
+ if (GetFrontMostPopupModal() != NULL)
g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f);
else
g.ModalWindowDarkeningRatio = 0.0f;
@@ -4029,7 +4028,7 @@
if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove))
g.MovingWindow = g.HoveredWindow;
}
- else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
+ else if (g.NavWindow != NULL && GetFrontMostPopupModal() == NULL)
{
// Clicking on void disable focus
FocusWindow(NULL);
@@ -4042,7 +4041,7 @@
{
// Find the top-most window between HoveredWindow and the front most Modal Window.
// This is where we can trim the popup stack.
- ImGuiWindow* modal = GetFrontMostModalRootWindow();
+ ImGuiWindow* modal = GetFrontMostPopupModal();
bool hovered_window_above_modal = false;
if (modal == NULL)
hovered_window_above_modal = true;
@@ -4916,7 +4915,7 @@
ClosePopupToLevel(n);
}
-static ImGuiWindow* GetFrontMostModalRootWindow()
+ImGuiWindow* ImGui::GetFrontMostPopupModal()
{
ImGuiContext& g = *GImGui;
for (int n = g.OpenPopupStack.Size-1; n >= 0; n--)
@@ -5962,7 +5961,7 @@
PushClipRect(viewport_rect.Min, viewport_rect.Max, true);
// Draw modal window background (darkens what is behind them)
- if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
+ if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostPopupModal())
window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
// Draw navigation selection/windowing rectangle background
diff --git a/imgui_internal.h b/imgui_internal.h
index cc90d9c..7f0c346 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -1052,6 +1052,7 @@
IMGUI_API bool IsPopupOpen(ImGuiID id);
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
+ IMGUI_API ImGuiWindow* GetFrontMostPopupModal();
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
IMGUI_API void NavMoveRequestCancel();