FullscreenUI: Fix some dialogs not being cancellable

i.e. exitable with right mouse click/B button.
This commit is contained in:
Stenzek 2025-03-15 02:18:18 +10:00
parent db3b689166
commit 4bac7cb79e
No known key found for this signature in database
2 changed files with 11 additions and 1 deletions

View File

@ -4659,7 +4659,8 @@ void FullscreenUI::DrawControllerSettingsPage()
ImGui::SetNextWindowSize(LayoutScale(500.0f, 180.0f));
if (BeginFixedPopupModal(freq_label, nullptr))
bool is_open = true;
if (BeginFixedPopupModal(freq_label, &is_open))
{
ImGui::SetNextItemWidth(LayoutScale(450.0f));
if (ImGui::SliderInt("##value", &frequency, 0, 60, FSUI_CSTR("Toggle every %d frames"),

View File

@ -650,6 +650,12 @@ bool ImGuiFullscreen::BeginFixedPopupModal(const char* name, bool* p_open)
return false;
}
if (p_open && *p_open && WantsToCloseMenu())
{
*p_open = false;
ImGui::CloseCurrentPopup();
}
// don't draw unreadable text
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.BackgroundTextColor);
return true;
@ -2816,6 +2822,9 @@ void ImGuiFullscreen::DrawMessageDialog()
if (ImGui::BeginPopupModal(win_id, &is_open, flags))
{
if (WantsToCloseMenu())
is_open = false;
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.BackgroundTextColor);
ResetFocusHere();