mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-29 08:20:00 -05:00
Nav: allow ImGuiKey_Menu or Shift + F10 to work on Begin()...BeginPopupContextItem() sequence aiming at title bar. (#8803, #9270)
This commit is contained in:
@@ -12507,7 +12507,7 @@ bool ImGui::IsPopupOpenRequestForItem(ImGuiPopupFlags popup_flags, ImGuiID id)
|
|||||||
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
||||||
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||||
return true;
|
return true;
|
||||||
if (g.NavOpenContextMenuItemId == id && IsItemFocused())
|
if (g.NavOpenContextMenuItemId == id && (IsItemFocused() || id == g.CurrentWindow->MoveId))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -14251,6 +14251,11 @@ static void ImGui::NavUpdateContextMenuRequest()
|
|||||||
return;
|
return;
|
||||||
g.NavOpenContextMenuItemId = g.NavId;
|
g.NavOpenContextMenuItemId = g.NavId;
|
||||||
g.NavOpenContextMenuWindowId = g.NavWindow->ID;
|
g.NavOpenContextMenuWindowId = g.NavWindow->ID;
|
||||||
|
|
||||||
|
// Allow triggering for Begin()..BeginPopupContextItem(). A possible alternative would be to use g.NavLayer == ImGuiNavLayer_Menu.
|
||||||
|
if (g.NavId == g.NavWindow->GetID("#CLOSE") || g.NavId == g.NavWindow->GetID("#COLLAPSE"))
|
||||||
|
g.NavOpenContextMenuItemId = g.NavWindow->MoveId;
|
||||||
|
|
||||||
g.NavInputSource = ImGuiInputSource_Keyboard;
|
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||||
SetNavCursorVisibleAfterMove();
|
SetNavCursorVisibleAfterMove();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user