From b545fbffd506df66ff5b080d21312a4fed2cc74a Mon Sep 17 00:00:00 2001 From: blankie Date: Sat, 4 Feb 2023 22:26:47 +0700 Subject: [PATCH] Don't construct IDs --- fragments/filters.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fragments/filters.cpp b/fragments/filters.cpp index aaf3d33..b08e036 100644 --- a/fragments/filters.cpp +++ b/fragments/filters.cpp @@ -24,11 +24,10 @@ static void render_filter(Filter* filter, std::string* title, bool* request_remo ImGui::AlignTextToFramePadding(); ImGui::Text("Title:%s%s", title->empty() ? "" : " ", title->c_str()); ImGui::SameLine(); - std::string change_title_id = std::string("changefiltertitle_") + std::to_string(reinterpret_cast(filter)); if (ImGui::Button("Edit")) { - ImGui::OpenPopup(change_title_id.c_str()); + ImGui::OpenPopup("change_filter_title"); } - if (ImGui::BeginPopup(change_title_id.c_str())) { + if (ImGui::BeginPopup("change_filter_title")) { ImGui::InputText("##title", title); ImGui::EndPopup(); } @@ -168,11 +167,10 @@ static inline void render_group_filter(GroupFilter* filter) { } } - std::string add_filter_id = std::string("addfilter_") + std::to_string(reinterpret_cast(filter)); if (ImGui::Button("+ add filter")) { - ImGui::OpenPopup(add_filter_id.c_str()); + ImGui::OpenPopup("add_filter"); } - if (ImGui::BeginPopup(add_filter_id.c_str())) { + if (ImGui::BeginPopup("add_filter")) { std::unique_ptr added_filter = render_add_filter_popup(); if (added_filter) { filter->filters.push_back(std::move(added_filter)); @@ -238,9 +236,9 @@ void filters_fragment(Config& active_config, Filters& active_filters, Filters& i } if (ImGui::Button("+ add filter")) { - ImGui::OpenPopup("addfilter_root"); + ImGui::OpenPopup("add_filter"); } - if (ImGui::BeginPopup("addfilter_root")) { + if (ImGui::BeginPopup("add_filter")) { std::unique_ptr added_filter = render_add_filter_popup(); if (added_filter) { inactive_filters.push_back(std::make_pair("", std::move(added_filter)));