Docking: Fixed dragging from title-bar empty space (#5181, #2645)

This would need a test in ImGuiTestSuite.
This commit is contained in:
ocornut 2023-06-12 15:26:30 +02:00
parent 0664877998
commit 3f63cee4c1
2 changed files with 17 additions and 11 deletions

View File

@ -30,16 +30,6 @@ HOW TO UPDATE?
and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users. and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users.
- Please report any issue! - Please report any issue!
-----------------------------------------------------------------------
VERSION 1.89.7 WIP (In Progress)
-----------------------------------------------------------------------
Other changes:
- Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either
ScrollX or ScrollY flags from being impossible to resize. (#6503)
----------------------------------------------------------------------- -----------------------------------------------------------------------
DOCKING+MULTI-VIEWPORT BRANCH (In Progress) DOCKING+MULTI-VIEWPORT BRANCH (In Progress)
----------------------------------------------------------------------- -----------------------------------------------------------------------
@ -107,6 +97,21 @@ Other changes:
Note that Linux/Mac still have inconsistent support for multi-viewports. If you want to help see https://github.com/ocornut/imgui/issues/2117. Note that Linux/Mac still have inconsistent support for multi-viewports. If you want to help see https://github.com/ocornut/imgui/issues/2117.
-----------------------------------------------------------------------
VERSION 1.89.7 WIP (In Progress)
-----------------------------------------------------------------------
Other changes:
- Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either
ScrollX or ScrollY flags from being impossible to resize. (#6503)
Docking+Viewports Branch:
- Docking: Fixed dragging from title-bar empty space (regression from 1.88 related to
keeping ID alive when calling low-level ButtonBehavior() directly). (#5181, #2645)
----------------------------------------------------------------------- -----------------------------------------------------------------------
VERSION 1.89.6 (Released 2023-05-31) VERSION 1.89.6 (Released 2023-05-31)
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@ -16740,11 +16740,12 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
} }
// When clicking on the title bar outside of tabs, we still focus the selected tab for that node // When clicking on the title bar outside of tabs, we still focus the selected tab for that node
// FIXME: TabItem use AllowItemOverlap so we manually perform a more specific test for now (hovered || held) // FIXME: TabItems submitted earlier use AllowItemOverlap so we manually perform a more specific test for now (hovered || held) in order to not cover them.
ImGuiID title_bar_id = host_window->GetID("#TITLEBAR"); ImGuiID title_bar_id = host_window->GetID("#TITLEBAR");
if (g.HoveredId == 0 || g.HoveredId == title_bar_id || g.ActiveId == title_bar_id) if (g.HoveredId == 0 || g.HoveredId == title_bar_id || g.ActiveId == title_bar_id)
{ {
bool held; bool held;
KeepAliveID(title_bar_id);
ButtonBehavior(title_bar_rect, title_bar_id, NULL, &held, ImGuiButtonFlags_AllowItemOverlap); ButtonBehavior(title_bar_rect, title_bar_id, NULL, &held, ImGuiButtonFlags_AllowItemOverlap);
if (g.HoveredId == title_bar_id) if (g.HoveredId == title_bar_id)
{ {