From 9389859ee95e2a3087623c480d5cb19efe7a2de6 Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 10 Jun 2026 17:27:18 -0500 Subject: [PATCH] fix(ui): stop overlay dialogs flashing open-then-closed (BeginOverlayDialog) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/ui/material/draw_helpers.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/material/draw_helpers.h b/src/ui/material/draw_helpers.h index 23301bc..fd2d1db 100644 --- a/src/ui/material/draw_helpers.h +++ b/src/ui/material/draw_helpers.h @@ -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; }