Ticket #2427: 2427_dic.diff

File 2427_dic.diff, 2.8 KB (added by trompetin17, 9 years ago)
  • source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp

     
    1 /* Copyright (C) 2012 Wildfire Games.
     1/* Copyright (C) 2014 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    122122    g_ConfigDir = config.GetPath(wxPATH_GET_SEPARATOR);
    123123}
    124124
    125 ATLASDLLIMPEXP void Atlas_StartWindow(const wchar_t* type)
    126 {
    127     // Initialise libxml2
    128     // (If we're executed from the game instead, it has the responsibility to initialise libxml2)
    129     LIBXML_TEST_VERSION
    130    
    131     g_InitialWindowType = type;
    132 #ifdef __WXMSW__
    133     wxEntry(g_Module);
    134 #else
    135 #ifdef __WXGTK__
    136     // Because we do GL calls from a secondary thread, Xlib needs to
    137     // be told to support multiple threads safely
    138     int status = XInitThreads();
    139     if (status == 0)
    140     {
    141         fprintf(stderr, "Error enabling thread-safety via XInitThreads\n");
    142     }
    143 #endif
    144     int argc = 1;
    145     char atlas[] = "atlas";
    146     char *argv[] = {atlas, NULL};
    147 #ifndef __WXOSX__
    148     wxEntry(argc, argv);
    149 #else
    150     // Fix for OS X init (see http://trac.wildfiregames.com/ticket/2427 )
    151     // If we launched from in-game, SDL started NSApplication which will
    152     // break some things in wxWidgets
    153     wxEntryStart(argc, argv);
    154     wxTheApp->OnInit();
    155     wxTheApp->OnRun();
    156     wxTheApp->OnExit();
    157     wxEntryCleanup();
    158 #endif
    159 
    160 #endif
    161 }
    162 
    163125ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, size_t WXUNUSED(flags))
    164126{
    165127    // This is called from the game thread.
     
    186148class AtlasDLLApp : public wxApp
    187149{
    188150public:
    189 
    190151#ifdef __WXOSX__
    191152    virtual bool OSXIsGUIApplication()
    192153    {
     
    365326};
    366327
    367328IMPLEMENT_APP_NO_MAIN(AtlasDLLApp);
     329
     330ATLASDLLIMPEXP void Atlas_StartWindow(const wchar_t* type)
     331{
     332    // Initialise libxml2
     333    // (If we're executed from the game instead, it has the responsibility to initialise libxml2)
     334    LIBXML_TEST_VERSION
     335   
     336    g_InitialWindowType = type;
     337#ifdef __WXMSW__
     338    wxEntry(g_Module);
     339#else
     340#ifdef __WXGTK__
     341    // Because we do GL calls from a secondary thread, Xlib needs to
     342    // be told to support multiple threads safely
     343    int status = XInitThreads();
     344    if (status == 0)
     345    {
     346        fprintf(stderr, "Error enabling thread-safety via XInitThreads\n");
     347    }
     348#endif
     349    int argc = 1;
     350    char atlas[] = "atlas";
     351    char *argv[] = {atlas, NULL};
     352#ifndef __WXOSX__
     353    wxEntry(argc, argv);
     354#else
     355    // Fix for OS X init (see http://trac.wildfiregames.com/ticket/2427 )
     356    // If we launched from in-game, SDL started NSApplication which will
     357    // break some things in wxWidgets
     358    wxApp::SetInstance(new AtlasDLLApp());
     359    wxEntry(argc, argv);
     360#endif
     361   
     362#endif
     363}
     364