From 059560d28b63d307bbb7cff09af8bef967450172 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 3 Oct 2018 18:11:35 +0200 Subject: [PATCH] ButtonBehavior, ImGuiButtonFlags_FlattenChildren flag can be used from a child window. Would typically affect calling SplitterBehavior() from a child window. --- imgui_widgets.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 7053d44d..c2e9014b 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -392,7 +392,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool flags |= ImGuiButtonFlags_PressedOnClickRelease; ImGuiWindow* backup_hovered_window = g.HoveredWindow; - if ((flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window) + const bool flatten_hovered_children = (flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window->RootWindow; + if (flatten_hovered_children) g.HoveredWindow = window; bool pressed = false; @@ -415,7 +416,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool } } - if ((flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window) + if (flatten_hovered_children) g.HoveredWindow = backup_hovered_window; // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.