Skip to content

Commit 2e95a84

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 a600124 commit 2e95a84

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
@@ -7428,6 +7428,12 @@ ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window)
74287428
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
74297429
{
74307430
ImGuiContext& g = *GImGui;
7431+
7432+
{
7433+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
7434+
CallContextHooks(&g, ImGuiContextHookType_BeginWindow);
7435+
}
7436+
74317437
const ImGuiStyle& style = g.Style;
74327438
IM_ASSERT(name != NULL && name[0] != '\0'); // Window name required
74337439
IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
@@ -8424,6 +8430,11 @@ void ImGui::End()
84248430
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
84258431
if (g.CurrentWindow)
84268432
SetCurrentViewport(g.CurrentWindow, g.CurrentWindow->Viewport);
8433+
8434+
{
8435+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
8436+
CallContextHooks(&g, ImGuiContextHookType_EndWindow);
8437+
}
84278438
}
84288439

84298440
void ImGui::BringWindowToFocusFront(ImGuiWindow* window)

imgui_internal.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,9 @@ struct ImGuiIDStackTool
22392239
//-----------------------------------------------------------------------------
22402240

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

22442246
struct ImGuiContextHook
22452247
{

0 commit comments

Comments
 (0)