]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/evtloop.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/evtloop.cpp
3 // Purpose: implementation of wxEventLoop for wxMac
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #include "wx/evtloop.h"
34 #include "wx/osx/private.h"
36 // ============================================================================
37 // wxEventLoop implementation
38 // ============================================================================
40 wxGUIEventLoop::wxGUIEventLoop()
44 static void DispatchAndReleaseEvent(EventRef theEvent
)
47 wxTheApp
->MacSetCurrentEvent( theEvent
, NULL
);
49 OSStatus status
= SendEventToEventTarget(theEvent
, GetEventDispatcherTarget());
50 if (status
== eventNotHandledErr
&& wxTheApp
)
51 wxTheApp
->MacHandleUnhandledEvent(theEvent
);
53 ReleaseEvent( theEvent
);
56 int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout
)
59 OSStatus status
= ReceiveNextEvent(0, NULL
, timeout
/1000, true, &event
);
63 wxFAIL_MSG( "unexpected ReceiveNextEvent() error" );
66 case eventLoopTimedOutErr
:
69 case eventLoopQuitErr
:
70 // according to QA1061 this may also occur
71 // when a WakeUp Process is executed
75 DispatchAndReleaseEvent(event
);