+ // it's necessary to call ProcessIdle() to update the frames sizes which
+ // might have been changed (it also will update other things set from
+ // OnUpdateUI() which is a nice (and desired) side effect)
+ for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *win = node->GetData();
+ win->OnInternalIdle();
+ }
+
+ if (wxTheApp->m_idleTag)
+ {
+ /* We need to temporarily remove idle callbacks or the loop will
+ never finish. */
+ gtk_idle_remove( wxTheApp->m_idleTag );
+ wxTheApp->m_idleTag = 0;
+
+ while (gtk_events_pending())
+ gtk_main_iteration();
+
+ /* re-add idle handler */
+ wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
+ }
+ else
+ {
+ while (gtk_events_pending())
+ gtk_main_iteration();
+ }
+
+ return TRUE;
+}
+
+gint wxapp_idle_callback( gpointer WXUNUSED(data) )
+{
+ if (!wxTheApp) return TRUE;
+
+ /* 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 );
+ wxTheApp->m_idleTag = 0;
+
+ /* indicate that we are now in idle mode - even so deeply
+ in idle mode that we don't get any idle events anymore.
+ this is like wxMSW where an idle event is sent only
+ once each time after the event queue has been completely
+ emptied */
+ g_isIdle = TRUE;
+
+ /* wake up other threads */
+ wxMutexGuiLeave();
+ wxUsleep(0);
+ wxMutexGuiEnter();
+