From e6b1e39847fc7c7e0a1ca425936bc7b053749df4 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 23 May 2015 13:43:13 +0100 Subject: [PATCH] WIP Menus: don't clamp windows within display when a position has been explicitly set by user. Menu item spacing uses ItemSpacing. (#126) --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index f0208b79..44ef159b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3577,7 +3577,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ // Clamp into display if (!(flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip)) { - if (window->AutoFitFrames <= 0 && g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. + if (!window_pos_set_by_api && window->AutoFitFrames <= 0 && g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. { ImVec2 padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding); window->PosFloat = ImMax(window->PosFloat + window->Size, padding) - window->Size; @@ -3741,7 +3741,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ window->DC.TreeDepth = 0; window->DC.StateStorage = &window->StateStorage; window->DC.GroupStack.resize(0); - window->MenuColumns.Update(3, style.ItemInnerSpacing.x, !window_was_visible); + window->MenuColumns.Update(3, style.ItemSpacing.x, !window_was_visible); if (window->AutoFitFrames > 0) window->AutoFitFrames--;