#include "wx/gdicmn.h"
#include "wx/event.h"
-#ifdef __DARWIN__
-#include <CoreFoundation/CoreFoundation.h>
-#else
-#include <CoreFoundation.h>
+#ifdef __WXMAC_OSX__
+#include <CoreFoundation/CFRunLoop.h>
#endif
class WXDLLEXPORT wxFrame;
WXEVENTHANDLERREF m_macEventHandler ;
WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
WXEVENTREF m_macCurrentEvent ;
+#ifdef __WXMAC_OSX__
CFRunLoopSourceRef m_macEventPosted ;
+#endif
public:
static bool s_macSupportPCMenuShortcuts ;
#endif //__WXDEBUG__
+#ifdef __WXMAC_OSX__
extern "C" {
/* m_macEventPosted run loop source callback: */
- void macPostedEventCallback(void *unused) { wxTheApp->ProcessPendingEvents(); }
+ void macPostedEventCallback(void *unused);
}
+void macPostedEventCallback(void *unused) {
+ wxTheApp->ProcessPendingEvents(); }
+#endif
+
bool wxApp::Initialize(int& argc, wxChar **argv)
{
// Mac-specific
wxMacCreateNotifierTable() ;
+#ifdef __WXMAC_OSX__
/* 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);
+#endif
UMAShowArrowCursor() ;
wxToolTip::RemoveToolTips() ;
#endif
+#ifdef __WXMAC_OSX__
if (m_macEventPosted)
{
CFRelease(m_macEventPosted);
}
m_macEventPosted = NULL;
+#endif
// One last chance for pending objects to be cleaned up
wxTheApp->DeletePendingObjects();
wxApp::wxApp()
{
- m_printMode = wxPRINT_WINDOWS;
+ m_printMode = wxPRINT_WINDOWS;
- m_macCurrentEvent = NULL ;
- m_macCurrentEventHandlerCallRef = NULL ;
- m_macEventPosted = NULL ;
+ m_macCurrentEvent = NULL ;
+ m_macCurrentEventHandlerCallRef = NULL ;
+#ifdef __WXMAC_OSX__
+ m_macEventPosted = NULL ;
+#endif
}
int wxApp::MainLoop()
void wxApp::WakeUpIdle()
{
+#ifdef __WXMAC_OSX__
if (m_macEventPosted)
{
CFRunLoopSourceSignal(m_macEventPosted);
}
+#endif
wxMacWakeUp() ;
}