浏览代码

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

This would need a test in ImGuiTestSuite.
ocornut 2 年之前
父节点
当前提交
3f63cee4c1
共有 2 个文件被更改,包括 17 次插入11 次删除
  1. 15 10
      docs/CHANGELOG.txt
  2. 2 1
      imgui.cpp

+ 15 - 10
docs/CHANGELOG.txt

@@ -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.
 - 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)
 -----------------------------------------------------------------------
@@ -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.
 
 
+-----------------------------------------------------------------------
+ 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)
 -----------------------------------------------------------------------

+ 2 - 1
imgui.cpp

@@ -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
-    // 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");
     if (g.HoveredId == 0 || g.HoveredId == title_bar_id || g.ActiveId == title_bar_id)
     {
         bool held;
+        KeepAliveID(title_bar_id);
         ButtonBehavior(title_bar_rect, title_bar_id, NULL, &held, ImGuiButtonFlags_AllowItemOverlap);
         if (g.HoveredId == title_bar_id)
         {