]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement wxApp::Yield
authorDavid Elliott <dfe@tgwbd.org>
Fri, 5 Sep 2003 18:29:15 +0000 (18:29 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Fri, 5 Sep 2003 18:29:15 +0000 (18:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/app.mm

index a71826f9e6a1b7ecf7c3fccdaef3dbdf63683a7c..ec398d67248cfbd68b04041db30edec2a51b1790 100644 (file)
@@ -43,6 +43,7 @@
 #import <Foundation/NSArray.h>
 #import <Foundation/NSAutoreleasePool.h>
 #import <Foundation/NSThread.h>
+#import <AppKit/NSEvent.h>
 
 // ----------------------------------------------------------------------------
 // globals
@@ -192,7 +193,6 @@ wxApp::wxApp()
     m_isInAssert = FALSE;
 #endif // __WXDEBUG__
 
-
     argc = 0;
     argv = NULL;
     m_cocoaApp = NULL;
@@ -316,8 +316,15 @@ bool wxApp::Yield(bool onlyIfNeeded)
 
     s_inYield = true;
 
-    wxLogDebug("WARNING: SUPPOSED to have yielded!");
-    // FIXME: Do something!
+    // Run the event loop until it is out of events
+    while(NSEvent *event = [GetNSApplication()
+                nextEventMatchingMask:NSAnyEventMask
+                untilDate:[NSDate distantPast]
+                inMode:NSDefaultRunLoopMode
+                dequeue: YES])
+    {
+        [GetNSApplication() sendEvent: event];
+    }
 
 #if wxUSE_LOG
     // let the logs be flashed again