]> git.saurik.com Git - wxWidgets.git/commitdiff
Made wxGTK's wxEventLoop::IsRunning a little more consistent with
authorRobin Dunn <robin@alldunn.com>
Thu, 23 Sep 2004 00:58:21 +0000 (00:58 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 23 Sep 2004 00:58:21 +0000 (00:58 +0000)
wxMSW's and uninstall the idle handled like wxYield does so Pending
can eventually return false.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/evtloop.h
src/gtk/evtloop.cpp
src/gtk1/evtloop.cpp

index 42b00f2d03f85a03d350f96017cd2848e64c6115..d77cbf13ded28e72af724acb34eaff2e0722a364 100644 (file)
@@ -88,7 +88,7 @@ public:
     virtual void Exit(int rc = 0);
     virtual bool Pending() const;
     virtual bool Dispatch();
-    virtual bool IsRunning() const { return m_impl != NULL; }
+    virtual bool IsRunning() const { return GetActive() == this; }
 
 protected:
     // the pointer to the port specific implementation class
index acca1472fe639a9c0f136529e9c88e2f9216232c..74d4132b432737bc1b6be2efa7d14010488fbca2 100644 (file)
@@ -31,6 +31,7 @@
 #ifndef WX_PRECOMP
 #endif //WX_PRECOMP
 
+#include "wx/app.h"
 #include "wx/evtloop.h"
 
 #include <gtk/gtk.h>
@@ -103,9 +104,20 @@ void wxEventLoop::Exit(int rc)
 // wxEventLoop message processing dispatching
 // ----------------------------------------------------------------------------
 
+extern bool g_isIdle;
+
 bool wxEventLoop::Pending() const
 {
-    return gtk_events_pending() > 0;
+    if (wxTheApp && !g_isIdle)
+    {
+        // We need to remove idle callbacks or gtk_events_pending will
+        // never return false.
+        gtk_idle_remove( wxTheApp->m_idleTag );
+        wxTheApp->m_idleTag = 0;
+        g_isIdle = TRUE;
+    }
+
+    return gtk_events_pending();
 }
 
 bool wxEventLoop::Dispatch()
index acca1472fe639a9c0f136529e9c88e2f9216232c..74d4132b432737bc1b6be2efa7d14010488fbca2 100644 (file)
@@ -31,6 +31,7 @@
 #ifndef WX_PRECOMP
 #endif //WX_PRECOMP
 
+#include "wx/app.h"
 #include "wx/evtloop.h"
 
 #include <gtk/gtk.h>
@@ -103,9 +104,20 @@ void wxEventLoop::Exit(int rc)
 // wxEventLoop message processing dispatching
 // ----------------------------------------------------------------------------
 
+extern bool g_isIdle;
+
 bool wxEventLoop::Pending() const
 {
-    return gtk_events_pending() > 0;
+    if (wxTheApp && !g_isIdle)
+    {
+        // We need to remove idle callbacks or gtk_events_pending will
+        // never return false.
+        gtk_idle_remove( wxTheApp->m_idleTag );
+        wxTheApp->m_idleTag = 0;
+        g_isIdle = TRUE;
+    }
+
+    return gtk_events_pending();
 }
 
 bool wxEventLoop::Dispatch()