1
0
mirror of synced 2025-01-18 00:56:49 +01:00

fix: Empty popup opening when right clicking some provider tabs

This commit is contained in:
WerWolv 2023-11-27 15:37:22 +01:00
parent 494223fff6
commit 9cbfaed5fe

View File

@ -322,18 +322,20 @@ namespace hex::plugin::builtin {
break; break;
} }
std::string popupID = std::string("ProviderMenu.") + std::to_string(tabProvider->getID()); if (!tabProvider->getMenuEntries().empty()) {
if (ImGui::IsMouseReleased(1) && ImGui::IsItemHovered()) { std::string popupID = std::string("ProviderMenu.") + std::to_string(tabProvider->getID());
ImGui::OpenPopup(popupID.c_str()); if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsItemHovered()) {
} ImGui::OpenPopup(popupID.c_str());
}
if (ImGui::BeginPopup(popupID.c_str())) {
for (const auto &menuEntry : tabProvider->getMenuEntries()) { if (ImGui::BeginPopup(popupID.c_str())) {
if (ImGui::MenuItem(menuEntry.name.c_str())) { for (const auto &menuEntry : tabProvider->getMenuEntries()) {
menuEntry.callback(); if (ImGui::MenuItem(menuEntry.name.c_str())) {
} menuEntry.callback();
}
}
ImGui::EndPopup();
} }
ImGui::EndPopup();
} }
} }
ImGui::EndTabBar(); ImGui::EndTabBar();