瀏覽代碼

Tabs: avoid queuing a refocus when tab is already focused, which would have the side-effect of e.g. closing popup on a mouse release. (#7914)

ocornut 1 年之前
父節點
當前提交
8c4dceba08
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 0
      docs/CHANGELOG.txt
  2. 1 1
      imgui_widgets.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -83,6 +83,8 @@ Other changes:
 - Tables: fixes/revert a 1.90 change were outer border would be moved bottom and right
 - Tables: fixes/revert a 1.90 change were outer border would be moved bottom and right
   by an extra pixel + rework the change so that contents doesn't overlap the bottom and
   by an extra pixel + rework the change so that contents doesn't overlap the bottom and
   right border in a scrolling table. (#6765, #3752, #7428)
   right border in a scrolling table. (#6765, #3752, #7428)
+- Tabs: avoid queuing a refocus when tab is already focused, which would have the
+  side-effect of e.g. closing popup on a mouse release. (#7914)
 - InputText: allow callback to update buffer while in read-only mode. (imgui_club/#46)
 - InputText: allow callback to update buffer while in read-only mode. (imgui_club/#46)
 - InputText: fixed an issue programmatically refocusing a multi-line input which was just active. (#4761, #7870)
 - InputText: fixed an issue programmatically refocusing a multi-line input which was just active. (#4761, #7870)
 - TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660)
 - TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660)

+ 1 - 1
imgui_widgets.cpp

@@ -10096,7 +10096,7 @@ bool    ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
 
 
     // Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget.
     // Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget.
     const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
     const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
-    if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)) && !is_tab_button)
+    if (tab_bar->SelectedTabId != tab->ID && hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)) && !is_tab_button)
         TabBarQueueFocus(tab_bar, tab);
         TabBarQueueFocus(tab_bar, tab);
 
 
     if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)
     if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)