Added __WXMAC_OSX__ guards around the CFRunLoop calls, CFRunLoop not available on CFM [ followup on Patch 1160346 ]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,10 +21,8 @@
|
|||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#include "wx/event.h"
|
#include "wx/event.h"
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#ifdef __WXMAC_OSX__
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CFRunLoop.h>
|
||||||
#else
|
|
||||||
#include <CoreFoundation.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class WXDLLEXPORT wxFrame;
|
class WXDLLEXPORT wxFrame;
|
||||||
@@ -111,7 +109,9 @@ private:
|
|||||||
WXEVENTHANDLERREF m_macEventHandler ;
|
WXEVENTHANDLERREF m_macEventHandler ;
|
||||||
WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
|
WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
|
||||||
WXEVENTREF m_macCurrentEvent ;
|
WXEVENTREF m_macCurrentEvent ;
|
||||||
|
#ifdef __WXMAC_OSX__
|
||||||
CFRunLoopSourceRef m_macEventPosted ;
|
CFRunLoopSourceRef m_macEventPosted ;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool s_macSupportPCMenuShortcuts ;
|
static bool s_macSupportPCMenuShortcuts ;
|
||||||
|
@@ -607,11 +607,16 @@ pascal static void wxMacAssertOutputHandler(OSType componentSignature, UInt32 op
|
|||||||
|
|
||||||
#endif //__WXDEBUG__
|
#endif //__WXDEBUG__
|
||||||
|
|
||||||
|
#ifdef __WXMAC_OSX__
|
||||||
extern "C" {
|
extern "C" {
|
||||||
/* m_macEventPosted run loop source callback: */
|
/* 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)
|
bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||||
{
|
{
|
||||||
// Mac-specific
|
// Mac-specific
|
||||||
@@ -679,12 +684,14 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
|
|
||||||
wxMacCreateNotifierTable() ;
|
wxMacCreateNotifierTable() ;
|
||||||
|
|
||||||
|
#ifdef __WXMAC_OSX__
|
||||||
/* connect posted events to common-mode run loop so that wxPostEvent events
|
/* 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 */
|
are handled even while we're in the menu or on a scrollbar */
|
||||||
CFRunLoopSourceContext event_posted_context = {0};
|
CFRunLoopSourceContext event_posted_context = {0};
|
||||||
event_posted_context.perform = macPostedEventCallback;
|
event_posted_context.perform = macPostedEventCallback;
|
||||||
m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context);
|
m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context);
|
||||||
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
|
||||||
|
#endif
|
||||||
|
|
||||||
UMAShowArrowCursor() ;
|
UMAShowArrowCursor() ;
|
||||||
|
|
||||||
@@ -733,11 +740,13 @@ void wxApp::CleanUp()
|
|||||||
wxToolTip::RemoveToolTips() ;
|
wxToolTip::RemoveToolTips() ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WXMAC_OSX__
|
||||||
if (m_macEventPosted)
|
if (m_macEventPosted)
|
||||||
{
|
{
|
||||||
CFRelease(m_macEventPosted);
|
CFRelease(m_macEventPosted);
|
||||||
}
|
}
|
||||||
m_macEventPosted = NULL;
|
m_macEventPosted = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
// One last chance for pending objects to be cleaned up
|
// One last chance for pending objects to be cleaned up
|
||||||
wxTheApp->DeletePendingObjects();
|
wxTheApp->DeletePendingObjects();
|
||||||
@@ -871,11 +880,13 @@ bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec)
|
|||||||
|
|
||||||
wxApp::wxApp()
|
wxApp::wxApp()
|
||||||
{
|
{
|
||||||
m_printMode = wxPRINT_WINDOWS;
|
m_printMode = wxPRINT_WINDOWS;
|
||||||
|
|
||||||
m_macCurrentEvent = NULL ;
|
m_macCurrentEvent = NULL ;
|
||||||
m_macCurrentEventHandlerCallRef = NULL ;
|
m_macCurrentEventHandlerCallRef = NULL ;
|
||||||
m_macEventPosted = NULL ;
|
#ifdef __WXMAC_OSX__
|
||||||
|
m_macEventPosted = NULL ;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxApp::MainLoop()
|
int wxApp::MainLoop()
|
||||||
@@ -932,10 +943,12 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
|
|
||||||
void wxApp::WakeUpIdle()
|
void wxApp::WakeUpIdle()
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMAC_OSX__
|
||||||
if (m_macEventPosted)
|
if (m_macEventPosted)
|
||||||
{
|
{
|
||||||
CFRunLoopSourceSignal(m_macEventPosted);
|
CFRunLoopSourceSignal(m_macEventPosted);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
wxMacWakeUp() ;
|
wxMacWakeUp() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user