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

@@ -52,6 +52,9 @@ Other Changes:
for user code to bypass it without using a clickable item. (#9382) for user code to bypass it without using a clickable item. (#9382)
- Clicking on a window's empty-space to move/focus a window checks - Clicking on a window's empty-space to move/focus a window checks
for lack of queued focus request. (#9382) for lack of queued focus request. (#9382)
- Fixed double-click collapse toggle not owning the mouse button. If a
`SetNextWindowPos()` with pivot was queued in the same frame, the second
click could trigger another item in the same window. (#9439) [@Cleroth]
- InputText: - InputText:
- Added `style.InputTextCursorSize` to configure cursor/caret thickness. (#7031, #9409) - Added `style.InputTextCursorSize` to configure cursor/caret thickness. (#7031, #9409)
This is automatically scaled by `style.ScaleAllSizes()`. This is automatically scaled by `style.ScaleAllSizes()`.

View File

@@ -7714,7 +7714,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
ImRect title_bar_rect = window->TitleBarRect(); 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.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) if (g.IO.MouseClickedCount[0] == 2 && GetKeyOwner(ImGuiKey_MouseLeft) == ImGuiKeyOwner_NoOwner)
{
window->WantCollapseToggle = true; 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) if (window->WantCollapseToggle)
{ {
window->Collapsed = !window->Collapsed; window->Collapsed = !window->Collapsed;