mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-23 18:29:42 +00:00
Internals: Renamed CloseInactivePopups() to a better ClosePopupsOverWindow(). Exposed in imgui_internal.h
This commit is contained in:
parent
9bc5c089b6
commit
07163804df
11
imgui.cpp
11
imgui.cpp
@ -669,7 +669,6 @@ static void MarkIniSettingsDirty(ImGuiWindow* window);
|
|||||||
|
|
||||||
static ImRect GetViewportRect();
|
static ImRect GetViewportRect();
|
||||||
|
|
||||||
static void CloseInactivePopups(ImGuiWindow* ref_window);
|
|
||||||
static void ClosePopupToLevel(int remaining);
|
static void ClosePopupToLevel(int remaining);
|
||||||
static ImGuiWindow* GetFrontMostModalRootWindow();
|
static ImGuiWindow* GetFrontMostModalRootWindow();
|
||||||
|
|
||||||
@ -2549,7 +2548,7 @@ void ImGui::NewFrame()
|
|||||||
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
||||||
g.CurrentWindowStack.resize(0);
|
g.CurrentWindowStack.resize(0);
|
||||||
g.CurrentPopupStack.resize(0);
|
g.CurrentPopupStack.resize(0);
|
||||||
CloseInactivePopups(g.NavWindow);
|
ClosePopupsOverWindow(g.NavWindow);
|
||||||
|
|
||||||
// Create implicit window - we will only render it if the user has added something to it.
|
// Create implicit window - we will only render it if the user has added something to it.
|
||||||
// We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
|
// We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
|
||||||
@ -3000,7 +2999,7 @@ void ImGui::EndFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// With right mouse button we close popups without changing focus
|
// With right mouse button we close popups without changing focus
|
||||||
// (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger)
|
// (The left mouse button path calls FocusWindow which will lead NewFrame->ClosePopupsOverWindow to trigger)
|
||||||
if (g.IO.MouseClicked[1])
|
if (g.IO.MouseClicked[1])
|
||||||
{
|
{
|
||||||
// Find the top-most window between HoveredWindow and the front most Modal Window.
|
// Find the top-most window between HoveredWindow and the front most Modal Window.
|
||||||
@ -3017,7 +3016,7 @@ void ImGui::EndFrame()
|
|||||||
if (window == g.HoveredWindow)
|
if (window == g.HoveredWindow)
|
||||||
hovered_window_above_modal = true;
|
hovered_window_above_modal = true;
|
||||||
}
|
}
|
||||||
CloseInactivePopups(hovered_window_above_modal ? g.HoveredWindow : modal);
|
ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3772,7 +3771,7 @@ void ImGui::OpenPopupEx(ImGuiID id)
|
|||||||
else
|
else
|
||||||
g.OpenPopupStack[current_stack_size] = popup_ref;
|
g.OpenPopupStack[current_stack_size] = popup_ref;
|
||||||
|
|
||||||
// When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by CloseInactivePopups().
|
// When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by ClosePopupsOverWindow().
|
||||||
// This is equivalent to what ClosePopupToLevel() does.
|
// This is equivalent to what ClosePopupToLevel() does.
|
||||||
//if (g.OpenPopupStack[current_stack_size].PopupId == id)
|
//if (g.OpenPopupStack[current_stack_size].PopupId == id)
|
||||||
// FocusWindow(parent_window);
|
// FocusWindow(parent_window);
|
||||||
@ -3785,7 +3784,7 @@ void ImGui::OpenPopup(const char* str_id)
|
|||||||
OpenPopupEx(g.CurrentWindow->GetID(str_id));
|
OpenPopupEx(g.CurrentWindow->GetID(str_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CloseInactivePopups(ImGuiWindow* ref_window)
|
void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.OpenPopupStack.empty())
|
if (g.OpenPopupStack.empty())
|
||||||
|
@ -894,6 +894,7 @@ namespace ImGui
|
|||||||
|
|
||||||
IMGUI_API void OpenPopupEx(ImGuiID id);
|
IMGUI_API void OpenPopupEx(ImGuiID id);
|
||||||
IMGUI_API void ClosePopup(ImGuiID id);
|
IMGUI_API void ClosePopup(ImGuiID id);
|
||||||
|
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window);
|
||||||
IMGUI_API bool IsPopupOpen(ImGuiID id);
|
IMGUI_API bool IsPopupOpen(ImGuiID id);
|
||||||
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
||||||
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
|
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
|
||||||
|
Loading…
Reference in New Issue
Block a user