|
@@ -1803,9 +1803,9 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
|
|
DrawList = (ImDrawList*)ImGui::MemAlloc(sizeof(ImDrawList));
|
|
|
IM_PLACEMENT_NEW(DrawList) ImDrawList();
|
|
|
DrawList->_OwnerName = Name;
|
|
|
+ ParentWindow = NULL;
|
|
|
RootWindow = NULL;
|
|
|
RootNonPopupWindow = NULL;
|
|
|
- ParentWindow = NULL;
|
|
|
|
|
|
FocusIdxAllCounter = FocusIdxTabCounter = -1;
|
|
|
FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX;
|
|
@@ -1925,7 +1925,8 @@ void ImGui::ItemSize(const ImRect& bb, float text_offset_y)
|
|
|
// declares their minimum size requirement to ItemSize() and then use a larger region for drawing/interaction, which is passed to ItemAdd().
|
|
|
bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id)
|
|
|
{
|
|
|
- ImGuiWindow* window = GetCurrentWindow();
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ ImGuiWindow* window = g.CurrentWindow;
|
|
|
window->DC.LastItemId = id ? *id : 0;
|
|
|
window->DC.LastItemRect = bb;
|
|
|
window->DC.LastItemHoveredAndUsable = window->DC.LastItemHoveredRect = false;
|
|
@@ -1933,7 +1934,6 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id)
|
|
|
return false;
|
|
|
|
|
|
// This is a sensible default, but widgets are free to override it after calling ItemAdd()
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
if (IsMouseHoveringRect(bb.Min, bb.Max))
|
|
|
{
|
|
|
// Matching the behavior of IsHovered() but allow if ActiveId==window->MoveID (we clicked on the window background)
|
|
@@ -2210,7 +2210,7 @@ void ImGui::NewFrame()
|
|
|
g.ActiveIdIsAlive = false;
|
|
|
g.ActiveIdIsJustActivated = false;
|
|
|
|
|
|
- // Handle user moving window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
|
|
|
+ // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
|
|
|
if (g.MovedWindowMoveId && g.MovedWindowMoveId == g.ActiveId)
|
|
|
{
|
|
|
KeepAliveID(g.MovedWindowMoveId);
|
|
@@ -2221,7 +2221,7 @@ void ImGui::NewFrame()
|
|
|
if (!(g.MovedWindow->Flags & ImGuiWindowFlags_NoMove))
|
|
|
{
|
|
|
g.MovedWindow->PosFloat += g.IO.MouseDelta;
|
|
|
- if (!(g.MovedWindow->Flags & ImGuiWindowFlags_NoSavedSettings) && (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f))
|
|
|
+ if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)
|
|
|
MarkIniSettingsDirty(g.MovedWindow);
|
|
|
}
|
|
|
FocusWindow(g.MovedWindow);
|
|
@@ -3705,7 +3705,6 @@ void ImGui::EndChild()
|
|
|
sz.x = ImMax(4.0f, sz.x);
|
|
|
if (window->AutoFitChildAxises & 0x02)
|
|
|
sz.y = ImMax(4.0f, sz.y);
|
|
|
-
|
|
|
ImGui::End();
|
|
|
|
|
|
ImGuiWindow* parent_window = GetCurrentWindow();
|
|
@@ -4159,10 +4158,11 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
|
|
// Position tooltip (always follows mouse)
|
|
|
if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api)
|
|
|
{
|
|
|
- ImRect rect_to_avoid(g.IO.MousePos.x - 16, g.IO.MousePos.y - 8, g.IO.MousePos.x + 24, g.IO.MousePos.y + 24); // FIXME: Completely hard-coded. Perhaps center on cursor hit-point instead?
|
|
|
- window->PosFloat = FindBestPopupWindowPos(g.IO.MousePos, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
+ ImVec2 ref_pos = g.IO.MousePos;
|
|
|
+ ImRect rect_to_avoid(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24, ref_pos.y + 24); // FIXME: Completely hard-coded. Perhaps center on cursor hit-point instead?
|
|
|
+ window->PosFloat = FindBestPopupWindowPos(ref_pos, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
if (window->AutoPosLastDirection == -1)
|
|
|
- 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.
|
|
|
+ window->PosFloat = ref_pos + 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.
|
|
|
}
|
|
|
|
|
|
// Clamp position so it stays visible
|
|
@@ -4217,7 +4217,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
|
|
const float window_rounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding;
|
|
|
if (window->Collapsed)
|
|
|
{
|
|
|
- // Draw title bar only
|
|
|
+ // Title bar only
|
|
|
RenderFrame(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32(ImGuiCol_TitleBgCollapsed), true, window_rounding);
|
|
|
}
|
|
|
else
|