]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/app.cpp
Fixed and refactored wxPropertyGridManager decsription text box painting
[wxWidgets.git] / src / x11 / app.cpp
index dad65db005e1cabb283c6b9143cf6b24e488f319..e37d35ad289238cb92ba20807db52b360c8098ec 100644 (file)
@@ -25,6 +25,7 @@
     #include "wx/memory.h"
     #include "wx/gdicmn.h"
     #include "wx/module.h"
+    #include "wx/crt.h"
 #endif
 
 #include "wx/evtloop.h"
@@ -768,7 +769,7 @@ void wxApp::Exit()
 
 // Yield to other processes
 
-bool wxApp::Yield(bool onlyIfNeeded)
+bool wxApp::DoYield(bool onlyIfNeeded, long eventsToProcess)
 {
     // Sometimes only 2 yields seem
     // to do the trick, e.g. in the
@@ -776,9 +777,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
     int i;
     for (i = 0; i < 2; i++)
     {
-        static bool s_inYield = false;
-
-        if ( s_inYield )
+        if ( m_isInsideYield )
         {
             if ( !onlyIfNeeded )
             {
@@ -788,22 +787,18 @@ bool wxApp::Yield(bool onlyIfNeeded)
             return false;
         }
 
-        s_inYield = true;
+        m_isInsideYield = true;
+        m_eventsToProcessInsideYield = eventsToProcess;
 
         // Make sure we have an event loop object,
         // or Pending/Dispatch will fail
-        wxEventLoopBase * const eventLoop = wxEventLoop::GetActive();
-        wxEventLoop* newEventLoop = NULL;
-        if (!eventLoop)
-        {
-            newEventLoop = new wxEventLoop;
-            wxEventLoop::SetActive(newEventLoop);
-        }
+        wxEventLoopGuarantor dummyLoopIfNeeded;
 
         // Call dispatch at least once so that sockets
         // can be tested
         wxTheApp->Dispatch();
 
+        // TODO: implement event filtering using the eventsToProcess mask
         while (wxTheApp && wxTheApp->Pending())
             wxTheApp->Dispatch();
 
@@ -812,13 +807,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
 #endif
         ProcessIdle();
 
-        if (newEventLoop)
-        {
-            wxEventLoop::SetActive(NULL);
-            delete newEventLoop;
-        }
-
-        s_inYield = false;
+        m_isInsideYield = false;
     }
 
     return true;