// it should return TRUE if more idle events are needed, FALSE if not
     virtual bool ProcessIdle() ;
 
-#if 0
-        // Send idle event to all top-level windows.
-        // Returns TRUE if more idle time is requested.
-    virtual bool SendIdleEvents();
-#endif
-
         // Send idle event to window and all subwindows
         // Returns TRUE if more idle time is requested.
     virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
 
+        // Perform standard OnIdle behaviour: call from port's OnIdle
+    void OnIdle(wxIdleEvent& event);
+
 
     // top level window functions
     // --------------------------
 
     virtual bool Yield(bool onlyIfNeeded = FALSE);
     virtual void WakeUpIdle() { CocoaRequestIdle(); }
     
-    /* Idle Processing */
-    void OnIdle(wxIdleEvent& event);
-
     virtual bool Initialize(int& argc, wxChar **argv);
     virtual void CleanUp();
     virtual bool CallOnInit();
 
     virtual bool Yield(bool onlyIfNeeded = FALSE);
     virtual void WakeUpIdle();
 
-    // implementation only from now on
-    void OnIdle( wxIdleEvent &event );
-
     virtual bool Initialize(int& argc, wxChar **argv);
     virtual void CleanUp();
 
 
     virtual bool Yield(bool onlyIfNeeded = FALSE);
     virtual void WakeUpIdle();
 
-    // implementation only from now on
-    void OnIdle( wxIdleEvent &event );
-
     virtual bool Initialize(int& argc, wxChar **argv);
     virtual void CleanUp();
 
 
     virtual bool Pending();
     virtual void Dispatch();
 
-    // implementation only from now on
-    void OnIdle(wxIdleEvent &event);
-
     virtual bool Initialize(int& argc, wxChar **argv);
     virtual void CleanUp();
 
 
     // implementation from now on
     // --------------------------
     
-    void OnIdle(wxIdleEvent& event);
-    
 protected:
     bool                  m_showOnInit;
     
 
     // implementation from now on
     // --------------------------
     
-    void OnIdle(wxIdleEvent& event);
-    
     // Processes an X event.
     virtual bool ProcessXEvent(WXEvent* event);
     
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxApp::OnIdle)
+    EVT_IDLE(wxAppBase::OnIdle)
 //    EVT_END_SESSION(wxApp::OnEndSession)
 //    EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
 END_EVENT_TABLE()
 {
 }
 
-void wxApp::OnIdle(wxIdleEvent& event)
-{
-    wxLogDebug("wxApp::OnIdle");
-#if 0
-   static bool s_inOnIdle = FALSE;
-
-    // Avoid recursion (via ProcessEvent default case)
-    if ( s_inOnIdle )
-        return;
-    s_inOnIdle = TRUE;
-#endif
-
-
-    DeletePendingObjects();
-
-    // flush the logged messages if any
-    wxLog *pLog = wxLog::GetActiveTarget();
-    if ( pLog != NULL && pLog->HasPendingMessages() )
-        pLog->Flush();
-
-#if 0
-    // Send OnIdle events to all windows
-    bool needMore = SendIdleEvents();
-
-    if (needMore)
-      event.RequestMore(TRUE);
-
-    s_inOnIdle = FALSE;
-#endif
-}
-
 // Yield to other processes
 
 bool wxApp::Yield(bool onlyIfNeeded)
 
     return needMore;
 }
 
-#if 0
-// Send idle event to all top-level windows
-bool wxAppBase::SendIdleEvents()
-{
-    bool needMore = FALSE;
-
-    wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
-    while (node)
-    {
-        wxWindow* win = node->GetData();
-        if (SendIdleEvents(win))
-            needMore = TRUE;
-        node = node->GetNext();
-    }
-
-    return needMore;
-}
-#endif
-
 // Send idle event to window and all subwindows
 bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event)
 {
     return needMore;
 }
 
+void wxAppBase::OnIdle(wxIdleEvent& event)
+{
+    // If there are pending events, we must process them: pending events
+    // are either events to the threads other than main or events posted
+    // with wxPostEvent() functions
+    // GRG: I have moved this here so that all pending events are processed
+    //   before starting to delete any objects. This behaves better (in
+    //   particular, wrt wxPostEvent) and is coherent with wxGTK's current
+    //   behaviour. Changed Feb/2000 before 2.1.14
+    ProcessPendingEvents();
+
+    // 'Garbage' collection of windows deleted with Close().
+    DeletePendingObjects();
+
+#if wxUSE_LOG
+    // flush the logged messages if any
+    wxLog::FlushActive();
+#endif // wxUSE_LOG
+
+}
 
 // ----------------------------------------------------------------------------
 // wxGUIAppTraitsBase
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
 
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxApp::OnIdle)
+    EVT_IDLE(wxAppBase::OnIdle)
 END_EVENT_TABLE()
 
 wxApp::wxApp()
     return visual;
 }
 
-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
-    // threads
-    ProcessPendingEvents();
-
-    // 'Garbage' collection of windows deleted with Close()
-    DeletePendingObjects();
-
-    // Now done in ProcessIdle()
-#if 0
-    // Send OnIdle events to all windows
-    bool needMore = SendIdleEvents();
-
-    if (needMore)
-        event.RequestMore(TRUE);
-#endif
-
-    s_inOnIdle = FALSE;
-}
-
 int wxApp::MainLoop()
 {
     gtk_main();
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
 
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxApp::OnIdle)
+    EVT_IDLE(wxAppBase::OnIdle)
 END_EVENT_TABLE()
 
 wxApp::wxApp()
     return visual;
 }
 
-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
-    // threads
-    ProcessPendingEvents();
-
-    // 'Garbage' collection of windows deleted with Close()
-    DeletePendingObjects();
-
-    // Now done in ProcessIdle()
-#if 0
-    // Send OnIdle events to all windows
-    bool needMore = SendIdleEvents();
-
-    if (needMore)
-        event.RequestMore(TRUE);
-#endif
-
-    s_inOnIdle = FALSE;
-}
-
 int wxApp::MainLoop()
 {
     gtk_main();
 
 
 void wxApp::OnIdle(wxIdleEvent& event)
 {
-    // Avoid recursion (via ProcessEvent default case)
-    if ( s_inOnIdle )
-        return;
-
-  s_inOnIdle = TRUE;
-
-  // 'Garbage' collection of windows deleted with Close().
-  DeletePendingObjects();
-
-  // flush the logged messages if any
-  wxLog *pLog = wxLog::GetActiveTarget();
-  if ( pLog != NULL && pLog->HasPendingMessages() )
-    pLog->Flush();
-
-    // Now done in ProcessIdle()
-#if 0
-  // Send OnIdle events to all windows
-  bool needMore = SendIdleEvents();
-
-  if (needMore)
-    event.RequestMore(TRUE);
-#endif
-
+    wxAppBase::OnIdle(event);
+    
     // If they are pending events, we must process them: pending events are
     // either events to the threads other than main or events posted with
     // wxPostEvent() functions
     wxMacProcessNotifierAndPendingEvents();
 
-  s_inOnIdle = FALSE;
   if(!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
     wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
 }
 
 
 void wxApp::OnIdle(wxIdleEvent& event)
 {
-    // Avoid recursion (via ProcessEvent default case)
-    if ( s_inOnIdle )
-        return;
-
-  s_inOnIdle = TRUE;
-
-  // 'Garbage' collection of windows deleted with Close().
-  DeletePendingObjects();
-
-  // flush the logged messages if any
-  wxLog *pLog = wxLog::GetActiveTarget();
-  if ( pLog != NULL && pLog->HasPendingMessages() )
-    pLog->Flush();
-
-    // Now done in ProcessIdle()
-#if 0
-  // Send OnIdle events to all windows
-  bool needMore = SendIdleEvents();
-
-  if (needMore)
-    event.RequestMore(TRUE);
-#endif
-
+    wxAppBase::OnIdle(event);
+    
     // If they are pending events, we must process them: pending events are
     // either events to the threads other than main or events posted with
     // wxPostEvent() functions
     wxMacProcessNotifierAndPendingEvents();
 
-  s_inOnIdle = FALSE;
   if(!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
     wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
 }
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
 
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxApp::OnIdle)
+    EVT_IDLE(wxAppBase::OnIdle)
 END_EVENT_TABLE()
 
 
     return TRUE;
 }
 
-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
-       threads */
-    ProcessPendingEvents();
-
-    // 'Garbage' collection of windows deleted with Close().
-    DeletePendingObjects();
-
-#if wxUSE_LOG
-    // flush the logged messages if any
-    wxLog::FlushActive();
-#endif // wxUSE_LOG
-
-    // Now done in ProcessIdle()
-#if 0
-    // Send OnIdle events to all windows
-    if ( SendIdleEvents() )
-        event.RequestMore(TRUE);
-#endif
-
-    s_inOnIdle = FALSE;
-}
-
 int wxApp::MainLoop()
 {
     int rt;
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxApp::OnIdle)
+    EVT_IDLE(wxAppBase::OnIdle)
 END_EVENT_TABLE()
 
 #ifdef __WXDEBUG__
     XtDispatchEvent((XEvent*) event); /* let Motif do the work */
 }
 
-void wxApp::OnIdle(wxIdleEvent& event)
-{
-    static bool inOnIdle = FALSE;
-
-    // Avoid recursion (via ProcessEvent default case)
-    if (inOnIdle)
-        return;
-
-    inOnIdle = TRUE;
-
-    // If there are pending events, we must process them: pending events
-    // are either events to the threads other than main or events posted
-    // with wxPostEvent() functions
-    // GRG: I have moved this here so that all pending events are processed
-    //   before starting to delete any objects. This behaves better (in
-    //   particular, wrt wxPostEvent) and is coherent with wxGTK's current
-    //   behaviour. Also removed the '#if wxUSE_THREADS' around it.
-    //  Changed Mar/2000 before 2.1.14
-
-    // Flush pending events.
-    ProcessPendingEvents();
-
-    // 'Garbage' collection of windows deleted with Close().
-    DeletePendingObjects();
-
-    // flush the logged messages if any
-    wxLog *pLog = wxLog::GetActiveTarget();
-    if ( pLog != NULL && pLog->HasPendingMessages() )
-        pLog->Flush();
-
-    // Now done in ProcessIdle()
-#if 0
-    // Send OnIdle events to all windows
-    bool needMore = SendIdleEvents();
-
-    if (needMore)
-        event.RequestMore(TRUE);
-#endif
-
-    inOnIdle = FALSE;
-}
-
 static char *fallbackResources[] = {
     "*menuBar.marginHeight: 0",
     "*menuBar.shadowThickness: 1",
 
         return;
 
     wxIsInOnIdleFlag = TRUE;
-
-    // If there are pending events, we must process them: pending events
-    // are either events to the threads other than main or events posted
-    // with wxPostEvent() functions
-    // GRG: I have moved this here so that all pending events are processed
-    //   before starting to delete any objects. This behaves better (in
-    //   particular, wrt wxPostEvent) and is coherent with wxGTK's current
-    //   behaviour. Changed Feb/2000 before 2.1.14
-    ProcessPendingEvents();
-
-    // 'Garbage' collection of windows deleted with Close().
-    DeletePendingObjects();
-
-#if wxUSE_LOG
-    // flush the logged messages if any
-    wxLog::FlushActive();
-#endif // wxUSE_LOG
+    
+    wxAppBase::OnIdle(event);
 
 #if wxUSE_DC_CACHEING
     // automated DC cache management: clear the cached DCs and bitmap
         wxDC::ClearCache();
 #endif // wxUSE_DC_CACHEING
 
-    // Now done in ProcessIdle()
-#if 0
-    // Send OnIdle events to all windows
-    if ( SendIdleEvents() )
-    {
-        // SendIdleEvents() returns TRUE if at least one window requested more
-        // idle events
-        event.RequestMore(TRUE);
-    }
-#endif
-
     wxIsInOnIdleFlag = FALSE;
 }
 
 
         return;
 
     gbInOnIdle = TRUE;
-
-    //
-    // If there are pending events, we must process them: pending events
-    // are either events to the threads other than main or events posted
-    // with wxPostEvent() functions
-    //
-    ProcessPendingEvents();
-
-    //
-    // 'Garbage' collection of windows deleted with Close().
-    //
-    DeletePendingObjects();
-
-#if wxUSE_LOG
-    //
-    // Flush the logged messages if any
-    //
-    wxLog::FlushActive();
-#endif // wxUSE_LOG
+    
+    wxAppBase::OnIdle(event);
 
 #if wxUSE_DC_CACHEING
     // automated DC cache management: clear the cached DCs and bitmap
         wxDC::ClearCache();
 #endif // wxUSE_DC_CACHEING
 
-    // Now done in ProcessIdle()
-#if 0
-    //
-    // Send OnIdle events to all windows
-    //
-    if (SendIdleEvents())
-    {
-        //
-        // SendIdleEvents() returns TRUE if at least one window requested more
-        // idle events
-        //
-        rEvent.RequestMore(TRUE);
-    }
-#endif
-
     gbInOnIdle = FALSE;
 } // end of wxApp::OnIdle
 
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxApp::OnIdle)
+    EVT_IDLE(wxAppBase::OnIdle)
 END_EVENT_TABLE()
 
 bool wxApp::Initialize(int& argc, wxChar **argv)
     return FALSE;
 }
 
-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
-    // threads
-    ProcessPendingEvents();
-
-    // 'Garbage' collection of windows deleted with Close()
-    DeletePendingObjects();
-
-    // Now done in ProcessIdle()
-#if 0
-    // Send OnIdle events to all windows
-    bool needMore = SendIdleEvents();
-
-    if (needMore)
-        event.RequestMore(TRUE);
-#endif
-
-    s_inOnIdle = FALSE;
-}
-
 void wxApp::WakeUpIdle()
 {
     // TODO: use wxMotif implementation?