Ticket #198: fix-sigint+term.patch

File fix-sigint+term.patch, 3.5 KB (added by Markus, 11 years ago)

open file dialog should work, the others still block

  • trunk/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp

    diff -Nur a/trunk/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp b/trunk/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp
    a b  
    150150#endif
    151151}
    152152
     153ATLASDLLIMPEXP void Atlas_CloseWindow()
     154{
     155    if (wxTheApp) {
     156        wxWindow *w;
     157        while ((w = wxTheApp->GetTopWindow())) {
     158            wxCloseEvent ev(wxEVT_CLOSE_WINDOW);
     159            wxPostEvent(w, ev);
     160
     161            if (!w->GetParent())
     162                return;
     163
     164            wxWindow *ow = w;
     165            while (ow == wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow() != NULL)
     166                usleep(100*1000);
     167        }
     168    }
     169}
     170
    153171ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, size_t WXUNUSED(flags))
    154172{
    155173    // This is called from the game thread.
  • trunk/source/tools/atlas/AtlasUI/Misc/DLLInterface.h

    diff -Nur a/trunk/source/tools/atlas/AtlasUI/Misc/DLLInterface.h b/trunk/source/tools/atlas/AtlasUI/Misc/DLLInterface.h
    a b  
    2525ATLASDLLIMPEXP void Atlas_SetMessagePasser(AtlasMessage::MessagePasser*);
    2626ATLASDLLIMPEXP void Atlas_SetDataDirectory(const wchar_t* path);
    2727ATLASDLLIMPEXP void Atlas_StartWindow(const wchar_t* type);
     28ATLASDLLIMPEXP void Atlas_CloseWindow();
    2829
    2930ATLASDLLIMPEXP void Atlas_GLSetCurrent(void* context);
    3031ATLASDLLIMPEXP void Atlas_GLSwapBuffers(void* context);
  • trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp

    diff -Nur a/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp b/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp
    a b  
    692692
    693693void ScenarioEditor::OnOpen(wxCommandEvent& WXUNUSED(event))
    694694{
    695     wxFileDialog dlg (NULL, wxFileSelectorPromptStr,
     695    wxFileDialog dlg(wxTheApp->GetTopWindow(), wxFileSelectorPromptStr,
    696696        Datafile::GetDataDirectory() + _T("/mods/public/maps/scenarios"), m_OpenFilename,
    697697        _T("PMP files (*.pmp)|*.pmp|All files (*.*)|*.*"),
    698698        wxFD_OPEN);
     699    wxTheApp->SetTopWindow(&dlg);
     700
    699701    // Set default filter
    700702    dlg.SetFilterIndex(0);
    701703
  • trunk/source/tools/atlas/GameInterface/GameLoop.cpp

    diff -Nur a/trunk/source/tools/atlas/GameInterface/GameLoop.cpp b/trunk/source/tools/atlas/GameInterface/GameLoop.cpp
    a b  
    5151
    5252// Loaded from DLL:
    5353void (*Atlas_StartWindow)(const wchar_t* type);
     54void (*Atlas_CloseWindow)();
    5455void (*Atlas_SetDataDirectory)(const wchar_t* path);
    5556void (*Atlas_SetConfigDirectory)(const wchar_t* path);
    5657void (*Atlas_SetMessagePasser)(MessagePasser*);
     
    217218        // Pump SDL events (e.g. hotkeys)
    218219        SDL_Event_ ev;
    219220        while (SDL_PollEvent(&ev.ev))
     221        {
    220222            in_dispatch_event(&ev);
     223            if (ev.ev.type == SDL_QUIT)
     224                Atlas_CloseWindow();
     225        }
    221226
    222227        if (g_GUI)
    223228            g_GUI->TickObjects();
     
    276281    try
    277282    {
    278283        dll.LoadSymbol("Atlas_StartWindow", Atlas_StartWindow);
     284        dll.LoadSymbol("Atlas_CloseWindow", Atlas_CloseWindow);
    279285        dll.LoadSymbol("Atlas_SetMessagePasser", Atlas_SetMessagePasser);
    280286        dll.LoadSymbol("Atlas_SetDataDirectory", Atlas_SetDataDirectory);
    281287        dll.LoadSymbol("Atlas_SetConfigDirectory", Atlas_SetConfigDirectory);