1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-08 23:44:19 +00:00

IsItemHovered() doesn't filter out the signal when activated item is a shortcut remote activation. (#9138, #456)

Amend a201af7354
This commit is contained in:
ocornut 2026-01-08 15:58:12 +01:00
parent 9ce41a92c3
commit 3389dfd9dd
2 changed files with 6 additions and 2 deletions

View file

@ -98,7 +98,6 @@ Breaking Changes:
- BeginPopupContextItem("foo", 0); // !! Behavior changed !! Was Left button. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft.
- BeginPopupContextItem("foo", ImGuiPopupFlags_NoReopen); // !! Behavior changed !! Was Left button + flags. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft | xxx.
Other Changes:
- Fonts:
@ -155,6 +154,9 @@ Other Changes:
noticeable by user but detected by sanitizers). (#9089) [@judicaelclair]
- Added GetItemFlags() in public API for consistency and to expose generic
flags of last submitted item. (#9127)
- IsItemHovered() without ImGuiHoveredFlags_AllowWhenBlockedByActiveItem
doesn't filter out the signal when activated item is a shortcut remote activation;
(which mimicks what's done internally in the ItemHoverable() function). (#9138)
- Debug Tools:
- Debug Log: fixed incorrectly printing characters in IO log when submitting
non-ASCII values to io.AddInputCharacter(). (#9099)

View file

@ -4824,7 +4824,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
// Test if another item is active (e.g. being dragged)
const ImGuiID id = g.LastItemData.ID;
if ((flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) == 0)
if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)
if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap && !g.ActiveIdFromShortcut)
{
// When ActiveId == MoveId it means that either:
// - (1) user clicked on void _or_ an item with no id, which triggers moving window (ActiveId is set even when window has _NoMove flag)
@ -13571,6 +13571,7 @@ static ImGuiInputSource ImGui::NavCalcPreferredRefPosSource()
ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.NavWindow;
const bool activated_shortcut = g.ActiveId != 0 && g.ActiveIdFromShortcut && g.ActiveId == g.LastItemData.ID;
//const bool activated_shortcut = false
// Testing for !activated_shortcut here could in theory be removed if we decided that activating a remote shortcut altered one of the g.NavDisableXXX flag.
if ((!g.NavCursorVisible || !g.NavHighlightItemUnderNav || !window) && !activated_shortcut)
@ -13586,6 +13587,7 @@ static ImVec2 ImGui::NavCalcPreferredRefPos()
ImGuiInputSource source = NavCalcPreferredRefPosSource();
const bool activated_shortcut = g.ActiveId != 0 && g.ActiveIdFromShortcut && g.ActiveId == g.LastItemData.ID;
//const bool activated_shortcut = false
if (source != ImGuiInputSource_Mouse && !activated_shortcut && window == NULL)
source = ImGuiInputSource_Mouse;