extern bool g_isIdle;
+bool g_mainThreadLocked = FALSE;
+
//-----------------------------------------------------------------------------
// local functions
//-----------------------------------------------------------------------------
// thread so we must lock it here ourselves
gdk_threads_enter();
- /* sent idle event to all who request them */
- while (wxTheApp->ProcessIdle()) { }
-
/* we don't want any more idle events until the next event is
sent to wxGTK */
gtk_idle_remove( wxTheApp->m_idleTag );
emptied */
g_isIdle = TRUE;
+ /* sent idle event to all who request them */
+ while (wxTheApp->ProcessIdle()) { }
+
// release lock again
gdk_threads_leave();
{
if (wxTheApp->m_wakeUpTimerTag) return;
- wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 500, wxapp_wakeup_timerout_callback, (gpointer) NULL );
+ wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 50, wxapp_wakeup_timerout_callback, (gpointer) NULL );
}
void wxapp_uninstall_thread_wakeup()
// unblock other threads wishing to do some GUI things
wxMutexGuiLeave();
+
+ g_mainThreadLocked = TRUE;
// wake up other threads
wxUsleep( 1 );
// block other thread again
wxMutexGuiEnter();
+ g_mainThreadLocked = FALSE;
+
wxapp_install_thread_wakeup();
// release lock again
void wxApp::OnIdle( wxIdleEvent &event )
{
static bool s_inOnIdle = FALSE;
-
+
/* Avoid recursion (via ProcessEvent default case) */
if (s_inOnIdle)
return;
-
+
s_inOnIdle = TRUE;
/* Resend in the main thread events which have been prepared in other
/* 'Garbage' collection of windows deleted with Close(). */
DeletePendingObjects();
- /* flush the logged messages if any */
-#if wxUSE_LOG
- wxLog *log = wxLog::GetActiveTarget();
- if (log != NULL && log->HasPendingMessages())
- log->Flush();
-#endif // wxUSE_LOG
-
/* Send OnIdle events to all windows */
bool needMore = SendIdleEvents();
event.RequestMore(TRUE);
s_inOnIdle = FALSE;
+
+ /* flush the logged messages if any */
+#if wxUSE_LOG
+ wxLog *log = wxLog::GetActiveTarget();
+ if (log != NULL && log->HasPendingMessages())
+ log->Flush();
+#endif // wxUSE_LOG
}
bool wxApp::SendIdleEvents()
wxPendingEventsLocker = new wxCriticalSection();
#endif
-/*
- wxTheFontNameDirectory = new wxFontNameDirectory;
- wxTheFontNameDirectory->Initialize();
-*/
-
wxTheColourDatabase = new wxColourDatabase( wxKEY_STRING );
wxTheColourDatabase->Initialize();
wxInitializeStockLists();
wxInitializeStockObjects();
+#if wxUSE_WX_RESOURCES
+ wxInitializeResourceSystem();
+#endif
+
wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE;
{
wxModule::CleanUpModules();
+#if wxUSE_WX_RESOURCES
+ wxCleanUpResourceSystem();
+#endif
+
if (wxTheColourDatabase)
delete wxTheColourDatabase;
+
wxTheColourDatabase = (wxColourDatabase*) NULL;
-/*
- if (wxTheFontNameDirectory) delete wxTheFontNameDirectory;
- wxTheFontNameDirectory = (wxFontNameDirectory*) NULL;
-*/
-
wxDeleteStockObjects();
wxDeleteStockLists();
int wxEntry( int argc, char *argv[] )
{
#if wxUSE_THREADS
- g_thread_init(NULL);
+ /* GTK 1.2 up to version 1.2.3 has broken threads */
+ if ((gtk_major_version == 1) &&
+ (gtk_minor_version == 2) &&
+ (gtk_micro_version < 4))
+ {
+ printf( "wxWindows warning: Disabled GUI threading due to outdated GTK version\n" );
+ }
+ else
+ {
+ g_thread_init(NULL);
+ }
#endif
gtk_set_locale();