#include "wx/gdicmn.h"
#include "wx/event.h"
+#include <CoreFoundation/CoreFoundation.h>
+
class WXDLLEXPORT wxFrame;
class WXDLLEXPORT wxWindowMac;
class WXDLLEXPORT wxApp ;
WXEVENTHANDLERREF m_macEventHandler ;
WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
WXEVENTREF m_macCurrentEvent ;
+ CFRunLoopSourceRef m_macEventPosted ;
public:
static bool s_macSupportPCMenuShortcuts ;
#endif //__WXDEBUG__
+extern "C" {
+ /* m_macEventPosted run loop source callback: */
+ void macPostedEventCallback(void *unused) { wxTheApp->ProcessPendingEvents(); }
+}
+
bool wxApp::Initialize(int& argc, wxChar **argv)
{
// Mac-specific
wxMacCreateNotifierTable() ;
+ /* connect posted events to common-mode run loop so that wxPostEvent events
+ are handled even while we're in the menu or on a scrollbar */
+ CFRunLoopSourceContext event_posted_context = {0};
+ event_posted_context.perform = macPostedEventCallback;
+ m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context);
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
+
UMAShowArrowCursor() ;
return true;
wxToolTip::RemoveToolTips() ;
#endif
+ if (m_macEventPosted)
+ {
+ CFRelease(m_macEventPosted);
+ }
+ m_macEventPosted = NULL;
+
// One last chance for pending objects to be cleaned up
wxTheApp->DeletePendingObjects();
m_macCurrentEvent = NULL ;
m_macCurrentEventHandlerCallRef = NULL ;
+ m_macEventPosted = NULL ;
}
int wxApp::MainLoop()
void wxApp::WakeUpIdle()
{
+ if (m_macEventPosted)
+ {
+ CFRunLoopSourceSignal(m_macEventPosted);
+ }
wxMacWakeUp() ;
}