Skip to content

Commit 82cfc2a

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 fc66567 commit 82cfc2a

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
@@ -7513,6 +7513,12 @@ static void SetWindowActiveForSkipRefresh(ImGuiWindow* window)
75137513
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
75147514
{
75157515
ImGuiContext& g = *GImGui;
7516+
7517+
{
7518+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
7519+
CallContextHooks(&g, ImGuiContextHookType_BeginWindow);
7520+
}
7521+
75167522
const ImGuiStyle& style = g.Style;
75177523
IM_ASSERT(name != NULL && name[0] != '\0'); // Window name required
75187524
IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
@@ -8523,6 +8529,11 @@ void ImGui::End()
85238529
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
85248530
if (g.CurrentWindow)
85258531
SetCurrentViewport(g.CurrentWindow, g.CurrentWindow->Viewport);
8532+
8533+
{
8534+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
8535+
CallContextHooks(&g, ImGuiContextHookType_EndWindow);
8536+
}
85268537
}
85278538

85288539
// Use ImDrawList::_SetTextureRef(), making our shared g.FontStack[] authorative against window-local ImDrawList.

imgui_internal.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,9 @@ struct ImGuiIDStackTool
23312331
//-----------------------------------------------------------------------------
23322332

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

23362338
struct ImGuiContextHook
23372339
{

0 commit comments

Comments
 (0)