]> git.saurik.com Git - wxWidgets.git/commitdiff
Improvements to OnIdle processing
authorJulian Smart <julian@anthemion.co.uk>
Sun, 13 Jul 2003 16:59:30 +0000 (16:59 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 13 Jul 2003 16:59:30 +0000 (16:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
include/wx/app.h
include/wx/window.h
src/common/appcmn.cpp
src/common/wincmn.cpp
src/gtk/app.cpp
src/gtk1/app.cpp
src/mac/app.cpp
src/mac/carbon/app.cpp
src/mgl/app.cpp
src/motif/app.cpp
src/msw/app.cpp
src/os2/app.cpp
src/x11/app.cpp

index c479f17df7e40305b67670fb989551527161388f..0850ae3b72d14d66ac8433fc7e3d2989c6ce9f3a 100644 (file)
@@ -381,13 +381,15 @@ public:
         // 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);
+    virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
 
 
     // top level window functions
index 877456d967a889a4928ce3568e2ce5cec635e186..dce69059f9b882836d3c9c13ca4798744608ab1e 100644 (file)
@@ -877,7 +877,7 @@ public:
         virtual void OnInternalIdle() {}
 
         // call internal idle recursively
-        void ProcessInternalIdle() ;
+//        void ProcessInternalIdle() ;
 
         // get the handle of the window for the underlying window system: this
         // is only used for wxWin itself or for user code which wants to call
index abc9545e04a70e6cfdc34074b448a5a1b66f5944..8fa4b91bd4510aac63ba729f4ba518670334342d 100644 (file)
@@ -210,24 +210,29 @@ void wxAppBase::DeletePendingObjects()
 // Returns TRUE if more time is needed.
 bool wxAppBase::ProcessIdle()
 {
+    wxIdleEvent event;
+    bool needMore = FALSE;
     wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
     node = wxTopLevelWindows.GetFirst();
     while (node)
     {
         wxWindow* win = node->GetData();
-        win->ProcessInternalIdle();
+        if (SendIdleEvents(win, event))
+            needMore = TRUE;
         node = node->GetNext();
     }
 
-    wxIdleEvent event;
     event.SetEventObject(this);
-    bool processed = ProcessEvent(event);
+    (void) ProcessEvent(event);
+    if (event.MoreRequested())
+        needMore = TRUE;
 
     wxUpdateUIEvent::ResetUpdateTime();
     
-    return processed && event.MoreRequested();
+    return needMore;
 }
 
+#if 0
 // Send idle event to all top-level windows
 bool wxAppBase::SendIdleEvents()
 {
@@ -244,26 +249,28 @@ bool wxAppBase::SendIdleEvents()
 
     return needMore;
 }
+#endif
 
 // Send idle event to window and all subwindows
-bool wxAppBase::SendIdleEvents(wxWindow* win)
+bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event)
 {
     bool needMore = FALSE;
     
+    win->OnInternalIdle();
     if (wxIdleEvent::CanSend(win))
     {
-        wxIdleEvent event;
         event.SetEventObject(win);
         win->GetEventHandler()->ProcessEvent(event);
 
-        needMore = event.MoreRequested();
+        if (event.MoreRequested())
+            needMore = TRUE;
     }
 
     wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
     while ( node )
     {
         wxWindow *win = node->GetData();
-        if (SendIdleEvents(win))
+        if (SendIdleEvents(win, event))
             needMore = TRUE;
 
         node = node->GetNext();
index 6cc620cf4faaaf6c6aa3a2f240e7ad6840ffca2a..c7c5001fd195d3a138b1bc5798602b19c11d0286 100644 (file)
@@ -1830,7 +1830,9 @@ void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
 #endif
 }
 
+#if 0
 // call internal idle recursively
+// may be obsolete (wait until OnIdle scheme stabilises)
 void wxWindowBase::ProcessInternalIdle()
 {
     OnInternalIdle();
@@ -1843,6 +1845,7 @@ void wxWindowBase::ProcessInternalIdle()
         node = node->GetNext();
     }
 }
+#endif
 
 // ----------------------------------------------------------------------------
 // dialog units translations
index 06afb50f124152bf32f60f8d36983211296acb2d..3235c6fbe521366f25c15bf507765d4c666b6e16 100644 (file)
@@ -551,11 +551,14 @@ void wxApp::OnIdle( wxIdleEvent &event )
     // '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;
 }
index 06afb50f124152bf32f60f8d36983211296acb2d..3235c6fbe521366f25c15bf507765d4c666b6e16 100644 (file)
@@ -551,11 +551,14 @@ void wxApp::OnIdle( wxIdleEvent &event )
     // '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;
 }
index d53f06edaf8d9922c74422712bea183b72e2963d..324f39baedc16fbf2e4c0246e8d37e0a7aa00305 100644 (file)
@@ -1029,7 +1029,6 @@ void wxApp::OnIdle(wxIdleEvent& event)
     if ( s_inOnIdle )
         return;
 
-
   s_inOnIdle = TRUE;
 
   // 'Garbage' collection of windows deleted with Close().
@@ -1040,11 +1039,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
   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
 
     // If they are pending events, we must process them: pending events are
     // either events to the threads other than main or events posted with
index d53f06edaf8d9922c74422712bea183b72e2963d..324f39baedc16fbf2e4c0246e8d37e0a7aa00305 100644 (file)
@@ -1029,7 +1029,6 @@ void wxApp::OnIdle(wxIdleEvent& event)
     if ( s_inOnIdle )
         return;
 
-
   s_inOnIdle = TRUE;
 
   // 'Garbage' collection of windows deleted with Close().
@@ -1040,11 +1039,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
   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
 
     // If they are pending events, we must process them: pending events are
     // either events to the threads other than main or events posted with
index 45f77b88ae150d4309768e29ca659f4e2a4da61e..2c505d83c24e3d0b3f9048962307bb5a4d63c73e 100644 (file)
@@ -294,9 +294,12 @@ void wxApp::OnIdle(wxIdleEvent &event)
     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;
 }
index c391382b4730324510d6742f78b76e83e7d3b07b..c01b74f67c2e898200a657ba119c351a55c9790d 100644 (file)
@@ -233,11 +233,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
     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;
 }
index bcd5771bd1c8ee8b32042943df37783c0a58e0fb..79153ef858a707e4a2824662733343ef85cfbf74 100644 (file)
@@ -828,6 +828,8 @@ void wxApp::OnIdle(wxIdleEvent& event)
         wxDC::ClearCache();
 #endif // wxUSE_DC_CACHEING
 
+    // Now done in ProcessIdle()
+#if 0
     // Send OnIdle events to all windows
     if ( SendIdleEvents() )
     {
@@ -835,6 +837,7 @@ void wxApp::OnIdle(wxIdleEvent& event)
         // idle events
         event.RequestMore(TRUE);
     }
+#endif
 
     wxIsInOnIdleFlag = FALSE;
 }
index bc7b9bd18e253c4973764c45b9bdb516c1e780c0..8af1146ac77b7c35dc0684cb9286e1eb64ec50ac 100644 (file)
@@ -807,6 +807,8 @@ void wxApp::OnIdle(
         wxDC::ClearCache();
 #endif // wxUSE_DC_CACHEING
 
+    // Now done in ProcessIdle()
+#if 0
     //
     // Send OnIdle events to all windows
     //
@@ -818,6 +820,8 @@ void wxApp::OnIdle(
         //
         rEvent.RequestMore(TRUE);
     }
+#endif
+
     gbInOnIdle = FALSE;
 } // end of wxApp::OnIdle
 
index ff91c2fb6b632ed61baf68fd1c88c8e1ce4e980e..4aa78528cc2c2d669069a655a8f27b55ecf54e48 100644 (file)
@@ -717,11 +717,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
     // '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;
 }