mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +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)
|
u_config_json_open_or_create_file(struct u_config_json *json, const char *filename)
|
||||||
{
|
{
|
||||||
json->file_loaded = false;
|
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];
|
char tmp[1024];
|
||||||
ssize_t ret = u_file_get_path_in_config_dir(filename, tmp, sizeof(tmp));
|
ssize_t ret = u_file_get_path_in_config_dir(filename, tmp, sizeof(tmp));
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
|
|
|
@ -60,6 +60,12 @@ gui_sdl2_imgui_loop(struct sdl2_program *p)
|
||||||
assert(res > 0);
|
assert(res > 0);
|
||||||
io->IniFilename = p->layout_file;
|
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
|
// Setup Platform/Renderer bindings
|
||||||
igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);
|
igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);
|
||||||
igImGui_ImplOpenGL3_Init(NULL);
|
igImGui_ImplOpenGL3_Init(NULL);
|
||||||
|
|
|
@ -150,6 +150,12 @@ sdl2_loop(struct sdl2_program *p)
|
||||||
assert(res > 0);
|
assert(res > 0);
|
||||||
io->IniFilename = p->layout_file;
|
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
|
// Setup Platform/Renderer bindings
|
||||||
igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);
|
igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx);
|
||||||
igImGui_ImplOpenGL3_Init(NULL);
|
igImGui_ImplOpenGL3_Init(NULL);
|
||||||
|
|
Loading…
Reference in a new issue