|
@@ -3575,9 +3575,12 @@ void ImGui::NewFrame()
|
|
|
g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
|
|
|
g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame))) : FLT_MAX;
|
|
|
|
|
|
+ // Find hovered window
|
|
|
+ // (needs to be before UpdateMouseMovingWindowNewFrame so we fill g.HoveredWindowUnderMovingWindow on the mouse release frame)
|
|
|
+ UpdateHoveredWindowAndCaptureFlags();
|
|
|
+
|
|
|
// Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering)
|
|
|
UpdateMouseMovingWindowNewFrame();
|
|
|
- UpdateHoveredWindowAndCaptureFlags();
|
|
|
|
|
|
// Background darkening/whitening
|
|
|
if (GetFrontMostPopupModal() != NULL || (g.NavWindowingTarget != NULL && g.NavWindowingHighlightAlpha > 0.0f))
|
|
@@ -4722,7 +4725,7 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- // Maximum window size is determined by the display size
|
|
|
+ // Maximum window size is determined by the viewport size or monitor size
|
|
|
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0;
|
|
|
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
|
|
ImVec2 size_min = style.WindowMinSize;
|
|
@@ -5081,7 +5084,7 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
|
|
const bool has_close_button = (p_open != NULL);
|
|
|
const bool has_collapse_button = !(flags & ImGuiWindowFlags_NoCollapse);
|
|
|
|
|
|
- // Close & collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)
|
|
|
+ // Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)
|
|
|
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
|
|
window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus;
|
|
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
|
@@ -5451,7 +5454,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)
|
|
|
window->Pos = FindBestWindowPosForPopup(window);
|
|
|
|
|
|
- // Clamp position/size so it stays visible
|
|
|
+ // Clamp position/size so window stays visible within its viewport or monitor
|
|
|
+
|
|
|
// Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
|
|
ImRect viewport_rect(GetViewportRect());
|
|
|
if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
|
|
@@ -8701,6 +8705,7 @@ void ImGui::PushColumnsBackground()
|
|
|
window->DrawList->ChannelsSetCurrent(0);
|
|
|
int cmd_size = window->DrawList->CmdBuffer.Size;
|
|
|
PushClipRect(columns->HostClipRect.Min, columns->HostClipRect.Max, false);
|
|
|
+ IM_UNUSED(cmd_size);
|
|
|
IM_ASSERT(cmd_size == window->DrawList->CmdBuffer.Size); // Being in channel 0 this should not have created an ImDrawCmd
|
|
|
}
|
|
|
|