Internals: Renamed GetFrontMostModalRootWindow() to GetFrontMostPopupModal() and exposed in imgui_internal.h (#1738)

This commit is contained in:
omar 2018-04-10 15:04:36 +02:00
parent 9117632bf0
commit 52cac135c9
2 changed files with 7 additions and 7 deletions

View File

@ -741,7 +741,6 @@ static void MarkIniSettingsDirty(ImGuiWindow* window);
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 @@ void ImGui::NewFrameUpdateHoveredWindowAndCaptureFlags()
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 @@ void ImGui::NewFrame()
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 @@ void ImGui::EndFrame()
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 @@ void ImGui::EndFrame()
{
// 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 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window)
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 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
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

View File

@ -1052,6 +1052,7 @@ namespace ImGui
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();