fix: Popups sometimes not opening until clicking on the window again

This commit is contained in:
WerWolv
2025-08-18 20:37:12 +02:00
parent 0908d040fa
commit b602fcc485

View File

@@ -523,6 +523,7 @@ namespace hex {
static bool sizeSet = false; static bool sizeSet = false;
static double popupDelay = -2.0; static double popupDelay = -2.0;
static u32 displayFrameCount = 0; static u32 displayFrameCount = 0;
static bool popupClosed = true;
static AutoReset<std::unique_ptr<impl::PopupBase>> currPopupStorage; static AutoReset<std::unique_ptr<impl::PopupBase>> currPopupStorage;
static Lang name(""); static Lang name("");
@@ -530,7 +531,7 @@ namespace hex {
auto &currPopup = *currPopupStorage; auto &currPopup = *currPopupStorage;
if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) { if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) {
if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) { if (popupClosed) {
if (popupDelay <= -1.0) { if (popupDelay <= -1.0) {
popupDelay = 0.2; popupDelay = 0.2;
} else { } else {
@@ -542,6 +543,8 @@ namespace hex {
displayFrameCount = 0; displayFrameCount = 0;
ImGui::OpenPopup(name); ImGui::OpenPopup(name);
popupClosed = false;
popups.pop_back(); popups.pop_back();
} }
} }
@@ -610,6 +613,7 @@ namespace hex {
positionSet = sizeSet = false; positionSet = sizeSet = false;
currPopup = nullptr; currPopup = nullptr;
popupClosed = true;
} }
} }
} }