The open source OpenXR runtime

gui: Make imgui.ini file live in config directory

+14
+1
src/xrt/targets/gui/gui_sdl2.h
··· 38 38 bool sdl_initialized; 39 39 SDL_Window *win; 40 40 SDL_GLContext ctx; 41 + char layout_file[1024]; 41 42 }; 42 43 43 44
+6
src/xrt/targets/gui/gui_sdl2_imgui.c
··· 7 7 * @ingroup gui 8 8 */ 9 9 10 + #include "util/u_file.h" 10 11 #include "util/u_var.h" 11 12 #include "util/u_time.h" 12 13 #include "util/u_misc.h" ··· 52 53 53 54 // Local state 54 55 ImGuiIO *io = igGetIO(); 56 + 57 + // Make window layout file "imgui.ini" live in config dir 58 + int res = u_file_get_path_in_config_dir("imgui.ini", p->layout_file, sizeof(p->layout_file)); 59 + assert(res > 0); 60 + io->IniFilename = p->layout_file; 55 61 56 62 // Setup Platform/Renderer bindings 57 63 igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);
+7
src/xrt/targets/openxr/oxr_sdl2_hack.c
··· 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 7 */ 8 8 9 + #include "util/u_file.h" 9 10 #include "xrt/xrt_instance.h" 10 11 #include "xrt/xrt_config_have.h" 11 12 #include "xrt/xrt_config_drivers.h" ··· 68 69 struct os_thread_helper oth; 69 70 70 71 bool sdl_initialized; 72 + char layout_file[1024]; 71 73 }; 72 74 73 75 struct gui_imgui ··· 141 143 142 144 // Local state 143 145 ImGuiIO *io = igGetIO(); 146 + 147 + // Make window layout file "imgui.ini" live in config dir 148 + int res = u_file_get_path_in_config_dir("imgui.ini", p->layout_file, sizeof(p->layout_file)); 149 + assert(res > 0); 150 + io->IniFilename = p->layout_file; 144 151 145 152 // Setup Platform/Renderer bindings 146 153 igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);