Skip to content

Commit 377d634

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 9fa6f00 commit 377d634

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
@@ -7540,6 +7540,12 @@ static void SetWindowActiveForSkipRefresh(ImGuiWindow* window)
75407540
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
75417541
{
75427542
ImGuiContext& g = *GImGui;
7543+
7544+
{
7545+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
7546+
CallContextHooks(&g, ImGuiContextHookType_BeginWindow);
7547+
}
7548+
75437549
const ImGuiStyle& style = g.Style;
75447550
IM_ASSERT(name != NULL && name[0] != '\0'); // Window name required
75457551
IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
@@ -8550,6 +8556,11 @@ void ImGui::End()
85508556
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
85518557
if (g.CurrentWindow)
85528558
SetCurrentViewport(g.CurrentWindow, g.CurrentWindow->Viewport);
8559+
8560+
{
8561+
// [ADAPT_IMGUI_BUNDLE]: added ImGuiContextHookType_BeginWindow, ImGuiContextHookType_EndWindow, cf https://github.com/thedmd/imgui-node-editor/issues/242#issuecomment-1681806764
8562+
CallContextHooks(&g, ImGuiContextHookType_EndWindow);
8563+
}
85538564
}
85548565

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

imgui_internal.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -2340,7 +2340,9 @@ struct ImGuiIDStackTool
23402340
//-----------------------------------------------------------------------------
23412341

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

23452347
struct ImGuiContextHook
23462348
{

0 commit comments

Comments
 (0)