#include "wx/thread.h"
#endif
-#include "unistd.h"
+#include <unistd.h>
-#include "glib.h"
-#include "gdk/gdk.h"
-#include "gtk/gtk.h"
+#include <glib.h>
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
#include "wx/gtk/win_gtk.h"
extern void wxFlushResources();
/* forward declaration */
-gint wxapp_idle_callback( gpointer WXUNUSED(data) );
-void wxapp_install_idle_handler();
-static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
+gint wxapp_idle_callback( gpointer WXUNUSED(data) );
+void wxapp_install_idle_handler();
+
+#if wxUSE_THREADS
+gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
+#endif
//-----------------------------------------------------------------------------
// wxExit
{
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
- /* this routine gets called by all event handlers
- indicating that the idle is over. */
+ /* This routine gets called by all event handlers
+ indicating that the idle is over. It may also
+ get called from other thread for sending events
+ to the main thread (and processing these in
+ idle time). */
+
+#if wxUSE_THREADS
+ if (!wxThread::IsMain())
+ GDK_THREADS_ENTER ();
+#endif
wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
g_isIdle = FALSE;
+
+#if wxUSE_THREADS
+ if (!wxThread::IsMain())
+ GDK_THREADS_LEAVE ();
+#endif
}
#if wxUSE_THREADS
wxTheApp->m_wakeUpTimerTag = 0;
}
-static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
+gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{
wxapp_uninstall_thread_wakeup();