Skip to content

Commit

Permalink
fix: Not being able to close certain modal popups with the close butt…
Browse files Browse the repository at this point in the history
…on 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.
  • Loading branch information
SparkyTD committed May 9, 2024
1 parent 978fa17 commit ea0cafa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main/gui/source/window/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ namespace hex {
ImGui::OpenPopup(name);
}

if (currPopup->shouldClose()) {
if (currPopup->shouldClose() || !open) {
log::debug("Closing popup '{}'", name);
positionSet = sizeSet = false;

Expand Down

0 comments on commit ea0cafa

Please sign in to comment.