X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03e11df5470fd64d9d9a669d0b50b84c2d714736..1454d4e6599bbd18086cdf0cf1b06c2b9004fe3a:/src/mac/app.cpp diff --git a/src/mac/app.cpp b/src/mac/app.cpp index e238e4f740..c7c54a882c 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -21,6 +21,7 @@ #include "wx/pen.h" #include "wx/brush.h" #include "wx/cursor.h" +#include "wx/intl.h" #include "wx/icon.h" #include "wx/palette.h" #include "wx/dc.h" @@ -52,7 +53,7 @@ #if wxUSE_SOCKETS #ifdef __APPLE__ - #include + #include #else #include #include @@ -94,25 +95,25 @@ bool wxApp::s_macSupportPCMenuShortcuts = true ; long wxApp::s_macAboutMenuItemId = wxID_ABOUT ; wxString wxApp::s_macHelpMenuTitleName = "&Help" ; -pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) +pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon ) { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEODoc( (AppleEvent*) event , reply) ; } -pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) +pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon ) { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEOApp( (AppleEvent*) event , reply ) ; } -pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) +pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon ) { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEPDoc( (AppleEvent*) event , reply ) ; } -pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) +pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ; @@ -356,6 +357,7 @@ bool wxApp::Initialize() #endif +#ifndef __UNIX__ // test the minimal configuration necessary long theSystem ; @@ -392,6 +394,7 @@ bool wxApp::Initialize() } } */ +#endif // if we encountered any problems so far, give the error code and exit immediately @@ -852,12 +855,22 @@ void wxCYield() } // Yield to other processes + +static bool gs_inYield = FALSE; + bool wxYield() { +#ifdef __WXDEBUG__ + if (gs_inYield) + wxFAIL_MSG( wxT("wxYield called recursively" ) ); +#endif + + gs_inYield = TRUE; + #if wxUSE_THREADS - YieldToAnyThread() ; + YieldToAnyThread() ; #endif - EventRecord event ; + EventRecord event ; long sleepTime = 0 ; //::GetCaretTime(); @@ -867,7 +880,19 @@ bool wxYield() } wxMacProcessNotifierAndPendingEvents() ; - return TRUE; + + gs_inYield = FALSE; + + return TRUE; +} + +// Yield to incoming messages; but fail silently if recursion is detected. +bool wxYieldIfNeeded() +{ + if (gs_inYield) + return FALSE; + + return wxYield(); } // platform specifics @@ -1444,7 +1469,11 @@ void wxApp::MacHandleOSEvent( EventRecord *ev ) case suspendResumeMessage : { bool isResuming = ev->message & resumeFlag ; +#if !TARGET_CARBON bool convertClipboard = ev->message & convertClipboardFlag ; +#else + bool convertClipboard = false; +#endif bool doesActivate = UMAGetProcessModeDoesActivateOnFGSwitch() ; if ( isResuming ) {