mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-16 12:03:27 +01:00
Merge branch 'viewport' into docking. 15ec78e
Fixes the update of title buffer when docked in a leaf dock node with a single window. Added comment about overwriting DockIsActive in DockNodeUpdate().
# Conflicts: # imgui.cpp
This commit is contained in:
commit
7525637804
21
imgui.cpp
21
imgui.cpp
@ -4890,15 +4890,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window = CreateNewWindow(name, size_on_first_use, flags);
|
||||
}
|
||||
|
||||
// Update stored window name when it changes (which can only happen with the "###" operator).
|
||||
// Only if it is meant to be displayed to the end user in a different place than the title bar (which already always display the 'name' parameter)
|
||||
bool window_title_visible_elsewhere = (window->Viewport && window->Viewport->Window == window) || (window->DockIsActive);
|
||||
if (!window_just_created && window_title_visible_elsewhere && strcmp(name, window->Name) != 0)
|
||||
{
|
||||
IM_DELETE(window->Name);
|
||||
window->Name = ImStrdup(name);
|
||||
}
|
||||
|
||||
// Automatically disable manual moving/resizing when NoInputs is set
|
||||
if (flags & ImGuiWindowFlags_NoInputs)
|
||||
flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
@ -5024,6 +5015,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
|
||||
window->IDStack.resize(1);
|
||||
|
||||
// Update stored window name when it changes (which can only happen with the "###" operator).
|
||||
// The title bar always display the 'name' parameter, so we only update storage if the title is displayed to the end-user in a different place.
|
||||
bool window_title_visible_elsewhere = (window->Viewport && window->Viewport->Window == window) || (window->DockIsActive);
|
||||
if (!window_just_created && window_title_visible_elsewhere && strcmp(name, window->Name) != 0)
|
||||
{
|
||||
IM_DELETE(window->Name);
|
||||
window->Name = ImStrdup(name);
|
||||
}
|
||||
|
||||
// UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS
|
||||
|
||||
// Update contents size from last frame for auto-fitting (or use explicit size)
|
||||
@ -10643,6 +10643,7 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
||||
node->HasCollapseButton = (node->Windows.Size > 0);
|
||||
for (int window_n = 0; window_n < node->Windows.Size; window_n++)
|
||||
{
|
||||
// FIXME: Setting DockIsActive here means that for single active window in a leaf node, DockIsActive will be cleared until the next Begin() call.
|
||||
ImGuiWindow* window = node->Windows[window_n];
|
||||
window->DockIsActive = (node->Windows.Size > 1);
|
||||
node->HasCloseButton |= window->HasCloseButton;
|
||||
@ -13072,7 +13073,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
ImGui::BulletText("NavRectRel[0]: <None>");
|
||||
ImGui::BulletText("Viewport: %d%s, ViewportId: 0x%08X, ViewportPos: (%.1f,%.1f)", window->Viewport ? window->Viewport->Idx : -1, window->ViewportOwned ? " (Owned)" : "", window->ViewportId, window->ViewportPos.x, window->ViewportPos.y);
|
||||
ImGui::BulletText("ViewportMonitor: %d", window->Viewport ? window->Viewport->PlatformMonitor : -1);
|
||||
ImGui::BulletText("DockId: 0x%04X, DockOrder: %d, %s: 0x%p", window->DockId, window->DockOrder, window->DockNodeAsHost ? "DockNodeAsHost" : "DockNode", window->DockNodeAsHost ? window->DockNodeAsHost : window->DockNode);
|
||||
ImGui::BulletText("DockId: 0x%04X, DockOrder: %d, %s: 0x%p, Act: %d, Vis: %d", window->DockId, window->DockOrder, window->DockNodeAsHost ? "DockNodeAsHost" : "DockNode", window->DockNodeAsHost ? window->DockNodeAsHost : window->DockNode, window->DockIsActive, window->DockTabIsVisible);
|
||||
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
||||
if (window->RootWindowDockStop != window->RootWindow) NodeWindow(window->RootWindowDockStop, "RootWindowDockStop");
|
||||
if (window->ParentWindow != NULL) NodeWindow(window->ParentWindow, "ParentWindow");
|
||||
|
Loading…
Reference in New Issue
Block a user