mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 23:06:36 +00:00
Various tweaks and fixes as suggested by PVS Studio (thanks PVS Studio!) [docking branch]
This commit is contained in:
parent
32c4e01267
commit
d1851ed6b7
12
imgui.cpp
12
imgui.cpp
@ -5064,10 +5064,11 @@ void ImGui::UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags
|
|||||||
window->ParentWindow = parent_window;
|
window->ParentWindow = parent_window;
|
||||||
window->RootWindow = window->RootWindowDockStop = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;
|
window->RootWindow = window->RootWindowDockStop = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;
|
||||||
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
|
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
|
||||||
|
{
|
||||||
window->RootWindow = parent_window->RootWindow;
|
window->RootWindow = parent_window->RootWindow;
|
||||||
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
|
|
||||||
if (!window->DockIsActive && !(parent_window->Flags & ImGuiWindowFlags_DockNodeHost))
|
if (!window->DockIsActive && !(parent_window->Flags & ImGuiWindowFlags_DockNodeHost))
|
||||||
window->RootWindowDockStop = parent_window->RootWindowDockStop;
|
window->RootWindowDockStop = parent_window->RootWindowDockStop;
|
||||||
|
}
|
||||||
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
||||||
window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;
|
window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;
|
||||||
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
||||||
@ -10507,12 +10508,9 @@ void ImGui::DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req)
|
|||||||
ImGuiDockNode* inheritor_node = target_node->ChildNodes[split_inheritor_child_idx];
|
ImGuiDockNode* inheritor_node = target_node->ChildNodes[split_inheritor_child_idx];
|
||||||
ImGuiDockNode* new_node = target_node->ChildNodes[split_inheritor_child_idx ^ 1];
|
ImGuiDockNode* new_node = target_node->ChildNodes[split_inheritor_child_idx ^ 1];
|
||||||
new_node->HostWindow = target_node->HostWindow;
|
new_node->HostWindow = target_node->HostWindow;
|
||||||
if (target_node)
|
|
||||||
{
|
|
||||||
inheritor_node->IsCentralNode = target_node->IsCentralNode;
|
inheritor_node->IsCentralNode = target_node->IsCentralNode;
|
||||||
inheritor_node->IsHiddenTabBar = target_node->IsHiddenTabBar;
|
inheritor_node->IsHiddenTabBar = target_node->IsHiddenTabBar;
|
||||||
target_node->IsCentralNode = false;
|
target_node->IsCentralNode = false;
|
||||||
}
|
|
||||||
target_node = new_node;
|
target_node = new_node;
|
||||||
}
|
}
|
||||||
target_node->IsHiddenTabBar = false;
|
target_node->IsHiddenTabBar = false;
|
||||||
@ -11453,7 +11451,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
|
|||||||
|
|
||||||
static bool DockNodeIsDropAllowedOne(ImGuiWindow* payload, ImGuiWindow* host_window)
|
static bool DockNodeIsDropAllowedOne(ImGuiWindow* payload, ImGuiWindow* host_window)
|
||||||
{
|
{
|
||||||
if ((host_window->Flags & ImGuiWindowFlags_DockNodeHost) && host_window->DockNodeAsHost->IsDockSpace && payload->BeginOrderWithinContext < host_window->BeginOrderWithinContext)
|
if (host_window->DockNodeAsHost && host_window->DockNodeAsHost->IsDockSpace && payload->BeginOrderWithinContext < host_window->BeginOrderWithinContext)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ImGuiWindowClass* host_class = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->WindowClass : &host_window->WindowClass;
|
ImGuiWindowClass* host_class = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->WindowClass : &host_window->WindowClass;
|
||||||
@ -12776,7 +12774,7 @@ void ImGui::BeginAsDockableDragDropTarget(ImGuiWindow* window)
|
|||||||
DockNodePreviewDockRender(window, target_node, payload_window, &split_outer);
|
DockNodePreviewDockRender(window, target_node, payload_window, &split_outer);
|
||||||
|
|
||||||
// Queue docking request
|
// Queue docking request
|
||||||
if (split_data && split_data->IsDropAllowed && payload->IsDelivery())
|
if (split_data->IsDropAllowed && payload->IsDelivery())
|
||||||
DockContextQueueDock(ctx, window, split_data->SplitNode, payload_window, split_data->SplitDir, split_data->SplitRatio, split_data == &split_outer);
|
DockContextQueueDock(ctx, window, split_data->SplitNode, payload_window, split_data->SplitDir, split_data->SplitRatio, split_data == &split_outer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13057,7 +13055,7 @@ void ImGui::LogToFile(int max_depth, const char* filename)
|
|||||||
|
|
||||||
IM_ASSERT(g.LogFile == NULL);
|
IM_ASSERT(g.LogFile == NULL);
|
||||||
g.LogFile = ImFileOpen(filename, "ab");
|
g.LogFile = ImFileOpen(filename, "ab");
|
||||||
if (!g.LogFile)
|
if (g.LogFile == NULL)
|
||||||
{
|
{
|
||||||
IM_ASSERT(g.LogFile != NULL); // Consider this an error
|
IM_ASSERT(g.LogFile != NULL); // Consider this an error
|
||||||
return;
|
return;
|
||||||
|
@ -1057,6 +1057,7 @@ struct ImGuiContext
|
|||||||
CurrentWindow = NULL;
|
CurrentWindow = NULL;
|
||||||
HoveredWindow = NULL;
|
HoveredWindow = NULL;
|
||||||
HoveredRootWindow = NULL;
|
HoveredRootWindow = NULL;
|
||||||
|
HoveredWindowUnderMovingWindow = NULL;
|
||||||
HoveredId = 0;
|
HoveredId = 0;
|
||||||
HoveredIdAllowOverlap = false;
|
HoveredIdAllowOverlap = false;
|
||||||
HoveredIdPreviousFrame = 0;
|
HoveredIdPreviousFrame = 0;
|
||||||
|
@ -6527,7 +6527,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
{
|
{
|
||||||
// We use a variable threshold to distinguish dragging tabs within a tab bar and extracting them out of the tab bar
|
// We use a variable threshold to distinguish dragging tabs within a tab bar and extracting them out of the tab bar
|
||||||
bool undocking_tab = (g.DragDropActive && g.DragDropPayload.SourceId == id);
|
bool undocking_tab = (g.DragDropActive && g.DragDropPayload.SourceId == id);
|
||||||
if (!undocking_tab && held)
|
if (!undocking_tab)
|
||||||
{
|
{
|
||||||
//if (!g.IO.ConfigDockingWithShift || g.IO.KeyShift)
|
//if (!g.IO.ConfigDockingWithShift || g.IO.KeyShift)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user