From ea0cafa229dfcf6bff7f5dea010535ec356ec718 Mon Sep 17 00:00:00 2001 From: SparkyTD <45818400+SparkyTD@users.noreply.github.com> Date: Thu, 9 May 2024 08:49:31 -0700 Subject: [PATCH] fix: Not being able to close certain modal popups with the close button on the title bar (#1659) ### Problem description When the close button is clicked, `ImGui::BeginPopupModal()` sets the bool passed into the second parameter (p_open) to false. However, the closing logic did not take this into account, making it difficult to actually close modal popups. For example, closing the "Export pattern File" modal took several clicks on the "X" button, now it closes instantly. ### Implementation description I added an additional check for the `open` variable being `false` in the logic that checks the closing condition. --- main/gui/source/window/window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index 838d2e613..056a59865 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -491,7 +491,7 @@ namespace hex { ImGui::OpenPopup(name); } - if (currPopup->shouldClose()) { + if (currPopup->shouldClose() || !open) { log::debug("Closing popup '{}'", name); positionSet = sizeSet = false;