fix(ui): stop overlay dialogs flashing open-then-closed (BeginOverlayDialog)

BeginOverlayDialog dismisses on a click outside the card via IsMouseClicked (mouse-down). When
the dialog is opened by a button that fires on the same frame (e.g. the mining tab's
"Update miner…" button), that opening click is still registered as an outside-click, so the
dialog opens and instantly closes — it just "flashes". Skip the outside-click dismissal on the
frame the scrim window first appears (ImGui::IsWindowAppearing()); normal outside-click closing
is unaffected on every subsequent frame. Fixes all overlay dialogs, not just the xmrig updater.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 17:27:18 -05:00
parent e63aba6959
commit 9389859ee9

View File

@@ -982,7 +982,10 @@ inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth
cardGlass.borderWidth = 1.0f;
DrawGlassPanel(dl, cardMin, cardMax, cardGlass);
if (p_open && ImGui::IsMouseClicked(ImGuiMouseButton_Left) &&
// Click outside the card dismisses the dialog — but NOT on the frame it first appears, otherwise
// the very click that opened it (a button fired the same frame) is read as an outside-click and
// the dialog flashes open then instantly closes.
if (p_open && !ImGui::IsWindowAppearing() && ImGui::IsMouseClicked(ImGuiMouseButton_Left) &&
!ImGui::IsMouseHoveringRect(cardMin, cardMax, false)) {
*p_open = false;
}