// Delay saving settings so we don't spam disk too much
if(g.SettingsDirtyTimer>0.0f)
@ -2019,11 +2046,11 @@ void ImGui::NewFrame()
}
// Find the window we are hovering. Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow
// Find window given position, search front-to-back
// FIXME: Note that we have a lag here because WindowRectClipped is updated in Begin() so windows moved by user via SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is called, aka before the next Begin(). Moving window thankfully isn't affected.
window->PosFloat=g.IO.MousePos+ImVec2(2,2);// If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
}
// User moving window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
KeepAliveID(window->MoveID);
if(g.ActiveId==window->MoveID)
{
if(g.IO.MouseDown[0])
{
if(!(flags&ImGuiWindowFlags_NoMove))
{
window->PosFloat+=g.IO.MouseDelta;
if(!(flags&ImGuiWindowFlags_NoSavedSettings))
MarkSettingsDirty();
}
IM_ASSERT(g.MovedWindow!=NULL);
FocusWindow(g.MovedWindow);
}
else
{
SetActiveID(0);
g.MovedWindow=NULL;// Not strictly necessary but doing it for sanity.
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
window->ClippedWindowRect =window->Rect();
window->ClippedWindowRect.Clip(window->ClipRect);
window->WindowRectClipped=window->Rect();
window->WindowRectClipped.Clip(window->ClipRect);
// Pressing CTRL+C while holding on a window copy its content to the clipboard
// This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope.
boolActiveIdIsJustActivated;// Set at the time of activation for one frame
boolActiveIdAllowOverlap;// Set only by active widget
ImGuiWindow*ActiveIdWindow;
ImGuiWindow*MovedWindow;// Track the child window we clicked on to move a window. Pointer is only valid if ActiveID is the "#MOVE" identifier of a window.
ImGuiWindow*MovedWindow;// Track the child window we clicked on to move a window.