Skip to content

Commit

Permalink
Docking: Fixed IsItemHovered() and functions depending on it (e.g. Be…
Browse files Browse the repository at this point in the history
…ginPopupContextItem()) when called after Begin() on a docked window (#3851)

Fix ee643b2
  • Loading branch information
ocornut committed Sep 22, 2021
1 parent fa0a314 commit ca097c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ Docking+Viewports Branch:
docking hierarchy. Added ImGuiHoveredFlags_DockHierarchy flag to consider docking hierarchy in the test.
- Nav: Fixed an issue with losing focus on docked windows when pressing Alt while keyboard navigation
is disabled. (#4547, #4439) [@PathogenDavid]
- Docking: Fixed IsItemHovered() and functions depending on it (e.g. BeginPopupContextItem()) when
called after Begin() on a docked window (broken 2021/03/04). (#3851)
- Docking: Improved resizing system so that non-central zone are better at keeping their fixed size.
The algorithm is still not handling the repartition of size idealy for nested sibling, but it got better.
- Docking: Fixed settings load issue when mouse wheeling. (#4310)
Expand Down
5 changes: 5 additions & 0 deletions imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8158,6 +8158,11 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
TabBarCloseTab(tab_bar, tab);
}

// Forward Hovered state so IsItemHovered() after Begin() can work (even though we are technically hovering our parent)
// That state is copied to window->DockTabItemStatusFlags by our caller.
if (docked_window && (hovered || g.HoveredId == close_button_id))
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;

// Restore main window position so user can draw there
if (want_clip_rect)
PopClipRect();
Expand Down

0 comments on commit ca097c2

Please sign in to comment.