Skip to content

Commit 0db725c

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 cf70360 commit 0db725c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

imgui.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -7372,6 +7372,12 @@ ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window)
73727372
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
73737373
{
73747374
ImGuiContext& g = *GImGui;
7375+
7376+
{
7377+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
7378+
CallContextHooks(&g, ImGuiContextHookType_BeginWindow);
7379+
}
7380+
73757381
const ImGuiStyle& style = g.Style;
73767382
IM_ASSERT(name != NULL && name[0] != '\0'); // Window name required
73777383
IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
@@ -8361,6 +8367,11 @@ void ImGui::End()
83618367
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
83628368
if (g.CurrentWindow)
83638369
SetCurrentViewport(g.CurrentWindow, g.CurrentWindow->Viewport);
8370+
8371+
{
8372+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
8373+
CallContextHooks(&g, ImGuiContextHookType_EndWindow);
8374+
}
83648375
}
83658376

83668377
void ImGui::BringWindowToFocusFront(ImGuiWindow* window)

imgui_internal.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,9 @@ struct ImGuiIDStackTool
22302230
//-----------------------------------------------------------------------------
22312231

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

22352237
struct ImGuiContextHook
22362238
{

0 commit comments

Comments
 (0)