diff --git a/event_loop.cpp b/event_loop.cpp index e8ab06a..187730a 100644 --- a/event_loop.cpp +++ b/event_loop.cpp @@ -53,8 +53,8 @@ static inline void logs_window(bool* show_logs_window) { ImGui::End(); } -static inline void main_window(Config& active_config, bool* show_settings_window, bool* show_logs_window, bool* exit_requested_rev) { - if (!ImGui::Begin("LogMeow", exit_requested_rev)) { +static inline void main_window(Config& active_config, bool* show_settings_window, bool* show_logs_window, bool* run_event_loop) { + if (!ImGui::Begin("LogMeow", run_event_loop)) { ImGui::End(); return; } @@ -107,27 +107,9 @@ static inline void debug_window() { ImGui::End(); } -static inline void exit_modal_if_necessary(bool* run_event_loop) { - if (!ImGui::BeginPopupModal("Exit?", nullptr, ImGuiWindowFlags_NoResize)) { - return; - } - ImGui::Text("Are you sure you want to exit?"); - - if (ImGui::Button("Yes", ImVec2(120, 0))) { - *run_event_loop = false; - } - ImGui::SameLine(); - if (ImGui::Button("No", ImVec2(120, 0))) { - ImGui::CloseCurrentPopup(); - } - ImGui::SetItemDefaultFocus(); - ImGui::EndPopup(); -} - void event_loop(Config& config, float* config_write_timer, bool* run_event_loop) { static bool show_settings_window = false; static bool show_logs_window = false; - static bool exit_requested_rev = true; debug_window(); @@ -145,10 +127,5 @@ void event_loop(Config& config, float* config_write_timer, bool* run_event_loop) logs_window(&show_logs_window); } - if (!exit_requested_rev) { - ImGui::OpenPopup("Exit?"); - exit_requested_rev = true; - } - exit_modal_if_necessary(run_event_loop); - main_window(config, &show_settings_window, &show_logs_window, &exit_requested_rev); + main_window(config, &show_settings_window, &show_logs_window, run_event_loop); }