Windows: fixed double-click collapse toggle not owning the mouse button. (#9439)

This commit is contained in:
Cleroth
2026-06-13 05:35:13 +08:00
committed by ocornut
parent 73a6610e81
commit 9a5c070308
2 changed files with 6 additions and 0 deletions

View File

@@ -7714,7 +7714,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
ImRect title_bar_rect = window->TitleBarRect();
if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && g.ActiveId == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max))
if (g.IO.MouseClickedCount[0] == 2 && GetKeyOwner(ImGuiKey_MouseLeft) == ImGuiKeyOwner_NoOwner)
{
window->WantCollapseToggle = true;
SetKeyOwner(ImGuiKey_MouseLeft, window->MoveId); // Claim input the same way ButtonBehavior() does. Prevent a same-frame move from triggering other items. (#9439)
}
if (window->WantCollapseToggle)
{
window->Collapsed = !window->Collapsed;