Add defines to disable setlocale and fork. Disable that code by default for now.
authorMichael Sartain <mikesart@valvesoftware.com>
Tue, 05 Feb 2013 12:10:54 -0800
changeset 6835 c259f0817583
parent 6834 dce4e1d1eca3
child 6836 b0ca1571caf3
Add defines to disable setlocale and fork. Disable that code by default for now.
src/video/x11/SDL_x11messagebox.c
--- a/src/video/x11/SDL_x11messagebox.c	Tue Feb 05 12:09:59 2013 -0800
+++ b/src/video/x11/SDL_x11messagebox.c	Tue Feb 05 12:10:54 2013 -0800
@@ -31,7 +31,8 @@
 #include <locale.h>
 
 
-#define SDL_FORK_MESSAGEBOX 1
+#define SDL_FORK_MESSAGEBOX 0
+#define SDL_SET_LOCALE      0
 
 #if SDL_FORK_MESSAGEBOX
 #include <sys/types.h>
@@ -645,13 +646,16 @@
 {
     int ret;
     SDL_MessageBoxDataX11 data;
+#if SDL_SET_LOCALE
     char *origlocale;
+#endif
 
     SDL_zero(data);
 
     if ( !SDL_X11_LoadSymbols() )
         return -1;
 
+#if SDL_SET_LOCALE
     origlocale = setlocale(LC_ALL, NULL);
     if (origlocale != NULL) {
         origlocale = SDL_strdup(origlocale);
@@ -661,6 +665,7 @@
         }
         setlocale(LC_ALL, "");
     }
+#endif
 
     /* This code could get called from multiple threads maybe? */
     XInitThreads();
@@ -682,10 +687,12 @@
 
     X11_MessageBoxShutdown( &data );
 
+#if SDL_SET_LOCALE
     if (origlocale) {
         setlocale(LC_ALL, origlocale);
         SDL_free(origlocale);
     }
+#endif
 
     return ret;
 }
@@ -700,6 +707,9 @@
     int fds[2];
     int status = 0;
 
+	/* Need to flush here in case someone has turned grab off and it hasn't gone through yet, etc. */
+	XFlush(data->display);
+
     if (pipe(fds) == -1) {
         return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
     }