src/video/x11/SDL_x11messagebox.c
changeset 6724 6c5ed0c4cc6d
parent 6723 7c464a9ecf48
child 6725 a7a99a9d419a
equal deleted inserted replaced
6723:7c464a9ecf48 6724:6c5ed0c4cc6d
   652 int
   652 int
   653 X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
   653 X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
   654 {
   654 {
   655     int ret;
   655     int ret;
   656     SDL_MessageBoxDataX11 data;
   656     SDL_MessageBoxDataX11 data;
       
   657     char *origlocale;
   657 
   658 
   658     SDL_zero(data);
   659     SDL_zero(data);
   659 
       
   660     setlocale(LC_ALL, "");
       
   661 
   660 
   662     if ( !SDL_X11_LoadSymbols() )
   661     if ( !SDL_X11_LoadSymbols() )
   663         return -1;
   662         return -1;
       
   663 
       
   664     origlocale = setlocale(LC_ALL, NULL);
       
   665     if (origlocale != NULL) {
       
   666         origlocale = SDL_strdup(origlocale);
       
   667         if (origlocale == NULL) {
       
   668             SDL_OutOfMemory();
       
   669             return -1;
       
   670         }
       
   671         setlocale(LC_ALL, "");
       
   672     }
   664 
   673 
   665     /* This code could get called from multiple threads maybe? */
   674     /* This code could get called from multiple threads maybe? */
   666     XInitThreads();
   675     XInitThreads();
   667 
   676 
   668     /* Initialize the return buttonid value to -1 (for error or dialogbox closed). */
   677     /* Initialize the return buttonid value to -1 (for error or dialogbox closed). */
   679             }
   688             }
   680         }
   689         }
   681     }
   690     }
   682 
   691 
   683     X11_MessageBoxShutdown( &data );
   692     X11_MessageBoxShutdown( &data );
       
   693 
       
   694     if (origlocale) {
       
   695         setlocale(LC_ALL, origlocale);
       
   696         SDL_free(origlocale);
       
   697     }
       
   698 
   684     return ret;
   699     return ret;
   685 }
   700 }
   686 
   701 
   687 #endif /* SDL_VIDEO_DRIVER_X11 */
   702 #endif /* SDL_VIDEO_DRIVER_X11 */
   688 
   703