diff --git a/base/sources/backends/linux_system.c b/base/sources/backends/linux_system.c index e1ebaf1f..012839d0 100644 --- a/base/sources/backends/linux_system.c +++ b/base/sources/backends/linux_system.c @@ -1494,8 +1494,15 @@ void iron_gamepad_rumble(int gamepad, float left, float right) {} #ifdef WITH_NFD // Has gtk #include -#include extern void (*iron_save_and_quit)(bool); +static bool iron_gtk_setlocale_disabled = false; +void iron_gtk_disable_setlocale() { + if (iron_gtk_setlocale_disabled) { + return; + } + gtk_disable_setlocale(); + iron_gtk_setlocale_disabled = true; +} #endif bool _save_and_quit_callback_internal() { @@ -1507,13 +1514,13 @@ bool _save_and_quit_callback_internal() { bool dirty = strstr(title, "* - ArmorPaint") != NULL; // XFree(title); if (dirty) { + iron_gtk_disable_setlocale(); gtk_init(NULL, NULL); GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, "Project has been modified, save changes?"); gtk_window_set_title(GTK_WINDOW(dialog), "Save Changes?"); gtk_widget_realize(dialog); gint res = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); - setlocale(LC_NUMERIC, "C"); // Restore locale! while (g_main_context_pending(NULL)) { g_main_context_iteration(NULL, FALSE); } diff --git a/base/sources/iron.h b/base/sources/iron.h index 27296a09..488ee13f 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -26,7 +26,6 @@ #include #include #include -#include #ifdef IRON_WINDOWS #include #endif @@ -723,7 +722,6 @@ void _iron_init(iron_window_options_t *ops) { ops->visible = enable_window; ops->color_bits = 32; iron_init(ops); - setlocale(LC_NUMERIC, "C"); iron_random_init((int)(iron_time() * 1000)); iron_set_cut_callback(_cut, NULL); iron_set_copy_callback(_copy, NULL); @@ -1332,7 +1330,6 @@ i32 iron_sys_command(string_t *cmd) { #else int result = system(cmd); #endif - setlocale(LC_NUMERIC, "C"); // Restore locale! return result; } diff --git a/base/sources/libs/nfd.c b/base/sources/libs/nfd.c index 9632fce7..07c411fd 100644 --- a/base/sources/libs/nfd.c +++ b/base/sources/libs/nfd.c @@ -157,6 +157,8 @@ int NFDi_IsFilterSegmentChar( char ch ) const char INIT_FAIL_MSG[] = "gtk_init_check failed to initilaize GTK+"; +void iron_gtk_disable_setlocale(); + static void AddTypeToFilterName( const char *typebuf, char *filterName, size_t bufsize ) { const char SEP[] = ", "; @@ -314,6 +316,7 @@ nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList, GtkWidget *dialog; nfdresult_t result; + iron_gtk_disable_setlocale(); if ( !gtk_init_check( NULL, NULL ) ) { NFDi_SetError(INIT_FAIL_MSG); @@ -371,6 +374,7 @@ nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList, GtkWidget *dialog; nfdresult_t result; + iron_gtk_disable_setlocale(); if ( !gtk_init_check( NULL, NULL ) ) { NFDi_SetError(INIT_FAIL_MSG); @@ -418,6 +422,7 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, GtkWidget *dialog; nfdresult_t result; + iron_gtk_disable_setlocale(); if ( !gtk_init_check( NULL, NULL ) ) { NFDi_SetError(INIT_FAIL_MSG); @@ -473,6 +478,7 @@ nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, GtkWidget *dialog; nfdresult_t result; + iron_gtk_disable_setlocale(); if (!gtk_init_check(NULL, NULL)) { NFDi_SetError(INIT_FAIL_MSG);