Qt editor: Fix freeze during lobby and loading on Linux

qteditor
Lukas Werling 2016-08-08 17:23:26 +02:00
parent b2bed04a7e
commit ec128bede4
3 changed files with 20 additions and 0 deletions

View File

@ -3350,6 +3350,9 @@ void C4Game::SetInitProgress(float fToProgress)
}
// Cheap hack to get the Console window updated while loading
Application.FlushMessages();
#ifdef WITH_QT_EDITOR
Application.ProcessQtEvents();
#endif
}
void C4Game::OnResolutionChanged(unsigned int iXRes, unsigned int iYRes)

View File

@ -62,10 +62,24 @@ bool C4AbstractApp::DoScheduleProcs(int iTimeout)
#if defined(USE_SDL_MAINLOOP) || defined(USE_COCOA)
// Unfortunately, the SDL event loop needs to be polled
FlushMessages();
#endif
#ifdef WITH_QT_EDITOR
// Some places, for example the lobby, have a nested event processing loop.
// To prevent the editor from freezing, call the Qt event loop here.
if (iTimeout)
ProcessQtEvents();
#endif
return StdScheduler::DoScheduleProcs(iTimeout);
}
#ifdef WITH_QT_EDITOR
void C4AbstractApp::ProcessQtEvents()
{
if (Application.isEditor)
QApplication::processEvents();
}
#endif
void C4Window::PerformUpdate()
{
}

View File

@ -71,6 +71,9 @@ public:
virtual bool DoScheduleProcs(int iTimeout);
bool FlushMessages();
#ifdef WITH_QT_EDITOR
void ProcessQtEvents();
#endif
C4Window * pWindow;
bool fQuitMsgReceived; // if true, a quit message has been received and the application should terminate