impr: Close context menus on focus loss

This commit is contained in:
WerWolv
2025-08-13 22:17:37 +02:00
parent 4b73e1a184
commit 6a1aa2c13e

View File

@@ -326,8 +326,16 @@ namespace hex::plugin::builtin {
if (ctx == nullptr)
return;
if (ImGui::IsPopupOpen("", ImGuiPopupFlags_AnyPopup))
if (ImGui::IsPopupOpen("", ImGuiPopupFlags_AnyPopup)) {
for (const auto& popup : ctx->OpenPopupStack) {
if (!(popup.Window->Flags & ImGuiWindowFlags_Modal)) {
ctx->OpenPopupStack.erase_unsorted(&popup);
log::debug("Closing popup '{}' because the main window lost focus", popup.Window->Name ? popup.Window->Name : "Unknown Popup");
break;
}
}
return;
}
if (ImGui::IsAnyItemHovered())
return;