Skip to content

Commit 1942772

Browse files
committed
[Bundle]: added ImGuiContextHookType_Begin/EndWindow
cf thedmd/imgui-node-editor#242 (comment) This helps fixing issues in popup positionning inside the node editor
1 parent 2d34b12 commit 1942772

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

imgui.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7102,6 +7102,12 @@ ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window)
71027102
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
71037103
{
71047104
ImGuiContext& g = *GImGui;
7105+
7106+
{
7107+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
7108+
CallContextHooks(&g, ImGuiContextHookType_BeginWindow);
7109+
}
7110+
71057111
const ImGuiStyle& style = g.Style;
71067112
IM_ASSERT(name != NULL && name[0] != '\0'); // Window name required
71077113
IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
@@ -8083,6 +8089,11 @@ void ImGui::End()
80838089
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
80848090
if (g.CurrentWindow)
80858091
SetCurrentViewport(g.CurrentWindow, g.CurrentWindow->Viewport);
8092+
8093+
{
8094+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
8095+
CallContextHooks(&g, ImGuiContextHookType_EndWindow);
8096+
}
80868097
}
80878098

80888099
void ImGui::BringWindowToFocusFront(ImGuiWindow* window)

imgui_internal.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2199,7 +2199,9 @@ struct ImGuiIDStackTool
21992199
//-----------------------------------------------------------------------------
22002200

22012201
typedef void (*ImGuiContextHookCallback)(ImGuiContext* ctx, ImGuiContextHook* hook);
2202-
enum ImGuiContextHookType { ImGuiContextHookType_NewFramePre, ImGuiContextHookType_NewFramePost, ImGuiContextHookType_EndFramePre, ImGuiContextHookType_EndFramePost, ImGuiContextHookType_RenderPre, ImGuiContextHookType_RenderPost, ImGuiContextHookType_Shutdown, ImGuiContextHookType_PendingRemoval_ };
2202+
2203+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
2204+
enum ImGuiContextHookType { ImGuiContextHookType_NewFramePre, ImGuiContextHookType_NewFramePost, ImGuiContextHookType_EndFramePre, ImGuiContextHookType_EndFramePost, ImGuiContextHookType_RenderPre, ImGuiContextHookType_RenderPost, ImGuiContextHookType_Shutdown, ImGuiContextHookType_PendingRemoval_, ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow };
22032205

22042206
struct ImGuiContextHook
22052207
{

0 commit comments

Comments
 (0)