mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
gui: Fix layout file not being created for the first time on Windows
By ensuring imgui.ini exists. Also enabled u_config_json_open_or_create_file for Windows as this OS has an implementation of u_file_get_path_in_config_dir available now.
This commit is contained in:
parent
bd265c611d
commit
3d366b9243
|
@ -44,7 +44,7 @@ static void
|
|||
u_config_json_open_or_create_file(struct u_config_json *json, const char *filename)
|
||||
{
|
||||
json->file_loaded = false;
|
||||
#if defined(XRT_OS_LINUX) && !defined(XRT_OS_ANDROID)
|
||||
#if (defined(XRT_OS_LINUX) || defined(XRT_OS_WINDOWS)) && !defined(XRT_OS_ANDROID)
|
||||
char tmp[1024];
|
||||
ssize_t ret = u_file_get_path_in_config_dir(filename, tmp, sizeof(tmp));
|
||||
if (ret <= 0) {
|
||||
|
|
|
@ -60,6 +60,12 @@ gui_sdl2_imgui_loop(struct sdl2_program *p)
|
|||
assert(res > 0);
|
||||
io->IniFilename = p->layout_file;
|
||||
|
||||
// Ensure imgui.ini file exists in config dir
|
||||
FILE *imgui_ini = u_file_open_file_in_config_dir("imgui.ini", "a");
|
||||
if (imgui_ini != NULL) {
|
||||
fclose(imgui_ini);
|
||||
}
|
||||
|
||||
// Setup Platform/Renderer bindings
|
||||
igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);
|
||||
igImGui_ImplOpenGL3_Init(NULL);
|
||||
|
|
|
@ -150,6 +150,12 @@ sdl2_loop(struct sdl2_program *p)
|
|||
assert(res > 0);
|
||||
io->IniFilename = p->layout_file;
|
||||
|
||||
// Ensure imgui.ini file exists in config dir
|
||||
FILE *imgui_ini = u_file_open_file_in_config_dir("imgui.ini", "a");
|
||||
if (imgui_ini != NULL) {
|
||||
fclose(imgui_ini);
|
||||
}
|
||||
|
||||
// Setup Platform/Renderer bindings
|
||||
igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);
|
||||
igImGui_ImplOpenGL3_Init(NULL);
|
||||
|
|
Loading…
Reference in a new issue