mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 04:28:47 +02:00
Backends: amends to 1db1066 + merge minor bits from docking incl SetActiveIdUsingNavAndKeys().
No need to clear fields before deletion. DX12: renamed to match docking branch.
This commit is contained in:
42
imgui.cpp
42
imgui.cpp
@ -3526,8 +3526,9 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
||||
FocusWindow(window);
|
||||
SetActiveID(window->MoveId, window);
|
||||
g.NavDisableHighlight = true;
|
||||
g.ActiveIdClickOffset = g.IO.MouseClickedPos[0] - window->RootWindow->Pos;
|
||||
g.ActiveIdNoClearOnFocusLoss = true;
|
||||
g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
|
||||
SetActiveIdUsingNavAndKeys();
|
||||
|
||||
bool can_move_window = true;
|
||||
if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||
@ -3563,8 +3564,8 @@ void ImGui::UpdateMouseMovingWindowNewFrame()
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearActiveID();
|
||||
g.MovingWindow = NULL;
|
||||
ClearActiveID();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -4155,7 +4156,7 @@ void ImGui::Initialize(ImGuiContext* context)
|
||||
g.Viewports.push_back(viewport);
|
||||
|
||||
#ifdef IMGUI_HAS_DOCK
|
||||
#endif // #ifdef IMGUI_HAS_DOCK
|
||||
#endif
|
||||
|
||||
g.Initialized = true;
|
||||
}
|
||||
@ -4951,6 +4952,16 @@ void ImGui::SetItemUsingMouseWheel()
|
||||
g.ActiveIdUsingMouseWheel = true;
|
||||
}
|
||||
|
||||
void ImGui::SetActiveIdUsingNavAndKeys()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.ActiveId != 0);
|
||||
g.ActiveIdUsingNavDirMask = ~(ImU32)0;
|
||||
g.ActiveIdUsingNavInputMask = ~(ImU32)0;
|
||||
g.ActiveIdUsingKeyInputMask = ~(ImU64)0;
|
||||
NavMoveRequestCancel();
|
||||
}
|
||||
|
||||
ImVec2 ImGui::GetItemRectMin()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
@ -9608,7 +9619,7 @@ static void ImGui::NavUpdateWindowing()
|
||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
|
||||
{
|
||||
g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow; // FIXME-DOCK: Will need to use RootWindowDockStop
|
||||
g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow;
|
||||
g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
||||
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
||||
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;
|
||||
@ -9863,10 +9874,8 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
||||
source_parent_id = window->IDStack.back();
|
||||
source_drag_active = IsMouseDragging(mouse_button);
|
||||
|
||||
// Disable navigation and key inputs while dragging
|
||||
g.ActiveIdUsingNavDirMask = ~(ImU32)0;
|
||||
g.ActiveIdUsingNavInputMask = ~(ImU32)0;
|
||||
g.ActiveIdUsingKeyInputMask = ~(ImU64)0;
|
||||
// Disable navigation and key inputs while dragging + cancel existing request if any
|
||||
SetActiveIdUsingNavAndKeys();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -10628,8 +10637,9 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl
|
||||
window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
|
||||
}
|
||||
IM_ASSERT(settings->ID == window->ID);
|
||||
settings->Pos = ImVec2ih((short)window->Pos.x, (short)window->Pos.y);
|
||||
settings->Size = ImVec2ih((short)window->SizeFull.x, (short)window->SizeFull.y);
|
||||
settings->Pos = ImVec2ih(window->Pos);
|
||||
settings->Size = ImVec2ih(window->SizeFull);
|
||||
|
||||
settings->Collapsed = window->Collapsed;
|
||||
}
|
||||
|
||||
@ -11233,6 +11243,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
Indent();
|
||||
Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);
|
||||
Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
|
||||
Text("ActiveIdUsing: Wheel: %d, NavDirMask: %X, NavInputMask: %X, KeyInputMask: %llX", g.ActiveIdUsingMouseWheel, g.ActiveIdUsingNavDirMask, g.ActiveIdUsingNavInputMask, g.ActiveIdUsingKeyInputMask);
|
||||
Text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
|
||||
Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
||||
Unindent();
|
||||
@ -11585,7 +11596,14 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
|
||||
const char* buf_end = buf + IM_ARRAYSIZE(buf);
|
||||
const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
|
||||
p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
|
||||
IM_UNUSED(p);
|
||||
p += ImFormatString(p, buf_end - p, " { ");
|
||||
for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++)
|
||||
{
|
||||
ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
|
||||
p += ImFormatString(p, buf_end - p, "%s'%s'",
|
||||
tab_n > 0 ? ", " : "", (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???");
|
||||
}
|
||||
p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } ");
|
||||
if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
|
||||
bool open = TreeNode(label, "%s", buf);
|
||||
if (!is_active) { PopStyleColor(); }
|
||||
@ -11605,7 +11623,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
|
||||
if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);
|
||||
if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();
|
||||
Text("%02d%c Tab 0x%08X '%s' Offset: %.1f, Width: %.1f/%.1f",
|
||||
tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "", tab->Offset, tab->Width, tab->ContentWidth);
|
||||
tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???", tab->Offset, tab->Width, tab->ContentWidth);
|
||||
PopID();
|
||||
}
|
||||
TreePop();
|
||||
|
Reference in New Issue
Block a user