From c90a1897a5488681639f93338d99adfd81e7a222 Mon Sep 17 00:00:00 2001 From: Dominik <45536968+authaldo@users.noreply.github.com> Date: Sat, 10 Feb 2024 20:18:18 +0000 Subject: [PATCH] minor changes --- src/rig_reconfigure.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rig_reconfigure.cpp b/src/rig_reconfigure.cpp index a8a4c5a..4d7af70 100644 --- a/src/rig_reconfigure.cpp +++ b/src/rig_reconfigure.cpp @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) { std::filesystem::create_directory(config_file_dir); } - ImGui::GetIO().IniFilename = config_file_path.c_str(); + ImGui::GetIO().IniFilename = config_file_path.c_str(); // important for automatic saving of .ini file ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable; // load window size if already stored from last iteration @@ -83,12 +83,15 @@ int main(int argc, char *argv[]) { auto window_height = DEFAULT_WINDOW_HEIGHT; if (configFileExisting) { + // manual loading of the .ini file since we require the window size before creating the glfw window ImGui::LoadIniSettingsFromDisk(config_file_path.c_str()); ImGuiID id = ImHashStr("Root window"); ImGuiWindowSettings* root_window_settings = ImGui::FindWindowSettingsByID(id); - window_width = root_window_settings->Size.x; - window_height = root_window_settings->Size.y; + if (root_window_settings != nullptr) { + window_width = root_window_settings->Size.x; + window_height = root_window_settings->Size.y; + } } // Create window with graphics context